Documentation
Contains all the errors used in Pyrinth.
InvalidParamError
Bases: Exception
Used when a parameter is invalid.
InvalidRequestError
Bases: Exception
Used when an invalid request is sent.
NoAuthorizationError
Bases: Exception
Used when a user isn't authorized.
NotFoundError
Bases: Exception
Used when something isn't found.
Contains all models used in Pyrinth.
ProjectModel
Bases: _Model
The model used for the Project class.
Attributes:
Name | Type | Description |
---|---|---|
slug |
str
|
The slug of the project, used for vanity URLs. Regex: ^[\w!@\(()`.+,"\-']{3,64}\) |
title |
str
|
The title or name of the project |
description |
str
|
A short description of the project |
categories |
list[str]
|
A list of categories that the project has |
client_side |
str
|
The client side support of the project |
server_side |
str
|
The server side support of the project |
body |
str
|
A long form description of the project |
additional_categories |
list[str]
|
A list of categories which are searchable but non-primary |
issues_url |
str
|
An optional link to where to submit bugs or issues with the project |
source_url |
str
|
An optional link to the source code of the project |
wiki_url |
str
|
An optional link to the project's wiki page or other relevant information |
discord_url |
str
|
An optional invite link to the project's discord |
donation_urls |
list[dict]
|
A list of donations for the project |
project_type |
str
|
The project type |
downloads |
int
|
The total number of downloads of the project |
icon_url |
str
|
The URL of the project's icon |
color |
str
|
The RGB color of the project, automatically generated from the project icon |
id |
str
|
The ID of the project, encoded as a base62 string |
team |
str
|
The ID of the team that has ownership of this project |
moderator_message |
dict
|
A message that a moderator sent regarding the project |
published |
str
|
The date the project was published |
updated |
str
|
The date the project was last updated |
approved |
str
|
The date of the project's status was set to approved or unlisted |
followers |
int
|
The total number of users following the project |
status |
str
|
The status of the project |
license |
dict
|
The license of the project |
version_ids |
list[str]
|
A list of version IDs of the project (will never be empty unless draft status) |
game_versions |
list[str]
|
A list of all the game versions supported by the project |
loaders |
list[str]
|
A list of all the loaders supported by the project |
gallery |
list[dict]
|
A list of images that have been uploaded to the project's gallery |
auth |
str
|
The project's authorization token |
VersionModel
Bases: _Model
The model used for the Version class.
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of this version |
version_number |
str
|
The version number. Ideally will follow semantic versioning |
changelog |
str
|
The changelog for this version |
dependencies |
list[dict]
|
A list of specific versions of projects that this version depends on |
game_versions |
list[str]
|
A list of versions of Minecraft that this version supports |
version_type |
str
|
The release channel for this version |
loaders |
list[str]
|
The mod loaders that this version supports |
featured |
bool
|
Whether the version is featured or not |
status |
str
|
The version's status |
requested_status |
str
|
The version's requested status |
files |
list[dict]
|
A list of files avaliable for download for this version |
project_id |
str
|
The ID of the project this version is for |
id |
str
|
The ID of the version, encoded as base62 string |
author_id |
str
|
The ID of the author who published this version |
date_published |
str
|
When the version was published |
downloads |
int
|
The number of times this version has been downloaded |
Modrinth
Source code in src/pyrinth/modrinth.py
get_random_projects(count=1)
staticmethod
Get a certain number of random projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
count |
int
|
The number of random projects to return |
1
|
Raises:
Type | Description |
---|---|
src.pyrinth.exceptions.InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
list[Project]
|
The projects that were randomly found |
Source code in src/pyrinth/modrinth.py
project_exists(id)
staticmethod
Check if a project exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
The ID or slug of the project |
required |
Raises:
Type | Description |
---|---|
InvalidRequestError
|
Invalid request |
NotFoundError
|
The requested project was not found |
Returns:
Type | Description |
---|---|
bool
|
Whether the project exists |
Source code in src/pyrinth/modrinth.py
Project can be mods or modpacks and are created by users.
Project
Project can be mods or modpacks and are created by users.
Attributes:
Name | Type | Description |
---|---|---|
model |
ProjectModel
|
The project's model |
Source code in src/pyrinth/projects.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 |
|
is_client_side: bool
property
Check if this project is client side.
Returns:
Type | Description |
---|---|
bool
|
Whether this project is client side |
is_server_side: bool
property
Check if this project is server side.
Returns:
Type | Description |
---|---|
bool
|
Whether this project is server side |
Dependency
dataclass
Source code in src/pyrinth/projects.py
1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 |
|
is_incompatible: bool
property
Check if the dependency is incompatible.
Returns:
Type | Description |
---|---|
bool
|
True if the dependency is incompatible, False otherwise |
is_optional: bool
property
Check if the dependency is optional.
Returns:
Type | Description |
---|---|
bool
|
True if the dependency is optional, False otherwise |
is_required: bool
property
Check if the dependency is required.
Returns:
Type | Description |
---|---|
bool
|
True if the dependency is required, False otherwise |
Donation
dataclass
Represents a donation.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The ID of the donation platform |
platform |
str
|
The donation platform this link is to |
url |
str
|
The URL of the donation platform and user |
Source code in src/pyrinth/projects.py
GalleryImage
Represents an image in a gallery.
Attributes:
Name | Type | Description |
---|---|---|
file_path |
str
|
The path to the image |
ext |
str
|
Image extension |
featured |
str
|
Whether an image is featured |
title |
str
|
Title of the image |
description |
str
|
Description of the image |
ordering |
int
|
Ordering of the image |
Source code in src/pyrinth/projects.py
License
dataclass
Represents a license.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The SPDX license ID of a project |
name |
str
|
The long name of a license |
url |
str
|
The URL to this license |
Source code in src/pyrinth/projects.py
Version
Versions contain download links to files with additional metadata.
Attributes:
Name | Type | Description |
---|---|---|
model |
VersionModel
|
The version model associated with the version |
Source code in src/pyrinth/projects.py
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 |
|
is_featured: bool
property
Check if the version is featured.
Returns:
Type | Description |
---|---|
bool
|
Whether the version is featured |
delete_file_from_hash(auth, hash, version_id, algorithm='sha1')
staticmethod
Delete a file from its hash.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hash |
str
|
The hash of the file, considering its byte content, and encoded in hexadecimal |
required |
algorithm |
Literal['sha512', 'sha1']
|
The algorithm of the hash |
'sha1'
|
version_id |
bool
|
Version ID to delete the version from if multiple files of the same hash exist |
required |
auth |
str
|
The authorization token to use when deleting the file from its hash |
required |
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested version wasn't found |
NoAuthorizationError
|
No authorization to delete this file |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
If the file deletion was successful |
Source code in src/pyrinth/projects.py
download(recursive=False)
Download the files associated with the version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recursive |
bool
|
Whether to also download the files of the dependencies |
False
|
Source code in src/pyrinth/projects.py
get(id)
staticmethod
Get a version by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
The ID of the version |
required |
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested version wasn't found or no authorization to see this version |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
Project.Version
|
The version that was found |
Source code in src/pyrinth/projects.py
get_from_hash(hash, algorithm='sha1', multiple=False)
staticmethod
Get a version by hash.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hash |
str
|
The hash of the file, considering its byte content, and encoded in hexadecimal |
required |
algorithm |
Literal['sha512', 'sha1']
|
The algorithm of the hash |
'sha1'
|
multiple |
bool
|
Whether to return multiple results when looking for this hash |
False
|
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested version file wasn't found or no authorization to see this version |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
Project.Version
|
The version that was found |
Source code in src/pyrinth/projects.py
add_gallery_image(image, auth=None)
Add a gallery image to the project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image |
Project.GalleryImage
|
The gallery image to add |
required |
auth |
str
|
The authorization token to use when adding the gallery image |
None
|
Raises:
Type | Description |
---|---|
NoAuthorizationError
|
No authorization to create a gallery image |
NotFoundError
|
The requested project wasn't found or no authorization to see this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
If the gallery image addition was successful |
Source code in src/pyrinth/projects.py
change_icon(file_path, auth=None)
Change the project icon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file_path |
str
|
The file path of the image to use for the new project icon |
required |
auth |
str
|
The authorization token to use when changing the project icon |
None
|
Raises:
Type | Description |
---|---|
InvalidParamError
|
Invalid input for new icon |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
Whether the project icon change was successful |
Source code in src/pyrinth/projects.py
create_version(version_model, auth=None)
Create a new version on the project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth |
str
|
The authorization token to use when creating the version |
None
|
version_model |
VersionModel
|
The model to use when creating the version |
required |
Raises:
Type | Description |
---|---|
NoAuthorizationError
|
No authorization to create this version |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
int
|
Whether creating the version was successful |
Source code in src/pyrinth/projects.py
delete(auth=None)
Delete the project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth |
str
|
Authentication token to use when deleting the project |
None
|
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested project wasn't found |
NoAuthorizationError
|
No authorization to delete this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
Whether the project deletion was successful |
Source code in src/pyrinth/projects.py
delete_gallery_image(url, auth=None)
Delete a gallery image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
URL link of the image to delete |
required |
auth |
str
|
Authentication token to use when deleting the gallery image |
None
|
Raises:
Type | Description |
---|---|
InvalidParamError
|
Invalid URL or project specified |
NoAuthorizationError
|
No authorization to delete this gallery image |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
Whether the gallery image deletion was successful |
Source code in src/pyrinth/projects.py
delete_icon(auth=None)
Delete the project icon.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
auth |
str
|
The authorization token to use when deleting the project icon |
None
|
Raises:
Type | Description |
---|---|
InvalidParamError
|
Invalid input |
NoAuthorizationError
|
No authorization to edit this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
Whether the project icon deletion was successful |
Source code in src/pyrinth/projects.py
download(recursive=False)
Download the project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
recursive |
bool
|
Whether to download dependencies. Defaults to False |
False
|
Source code in src/pyrinth/projects.py
get(id, authorization='')
staticmethod
Get a project by ID or slug.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
The ID or slug of the project |
required |
authorization |
str
|
An optional authorization token when getting the project |
''
|
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested project wasn't found or no authorization to see this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
Project
|
The project that was found |
Source code in src/pyrinth/projects.py
get_latest_version(loaders=None, game_versions=None, featured=None, type=None, auth=None)
Get the projects latest version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loaders |
list[str]
|
The loaders filter. Defaults to None |
None
|
game_versions |
list[str]
|
The game versions filter. Defaults to None |
None
|
featured |
bool
|
The is featured filter. Defaults to None |
None
|
type |
Literal['release', 'beta', 'alpha']
|
The types filter. Defaults to None |
None
|
auth |
str
|
The authorization token. Defaults to None |
None
|
Returns:
Type | Description |
---|---|
Project.Version
|
The project's latest version |
Source code in src/pyrinth/projects.py
get_multiple(ids)
staticmethod
Get multiple projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids |
list[str]
|
The IDs of the projects |
required |
Raises:
Type | Description |
---|---|
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
list[Project]
|
The projects that were found |
Source code in src/pyrinth/projects.py
get_oldest_version(loaders=None, game_versions=None, featured=None, type=None, auth=None)
Get the oldest project version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loaders |
list[str]
|
The types of loaders to filter for |
None
|
game_versions |
list[str]
|
The game versions to filter for |
None
|
featured |
bool
|
Allows to filter for featured or non-featured versions only |
None
|
type |
Literal['release', 'beta', 'alpha']
|
The type of version |
None
|
auth |
str
|
An optional authorization token to use when getting the project versions |
None
|
Returns:
Type | Description |
---|---|
Project.Version
|
The version that was found |
Source code in src/pyrinth/projects.py
get_specific_version(semantic_version)
Get a specific version based on the semantic version.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
semantic_version |
str
|
The semantic version to search for |
required |
Returns:
Type | Description |
---|---|
Project.Version
|
The version that was found using the semantic version |
None
|
No version was found with that semantic version |
Source code in src/pyrinth/projects.py
get_version(id)
staticmethod
Get a version by ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
The ID of the version |
required |
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested version wasn't found or no authorization to see this version |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
Project.Version
|
The version that was found |
Source code in src/pyrinth/projects.py
get_versions(loaders=None, game_versions=None, featured=None, types=None, auth=None)
Get project versions based on filters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
loaders |
list[str]
|
The types of loaders to filter for |
None
|
game_versions |
list[str]
|
The game versions to filter for |
None
|
featured |
bool
|
Allows to filter for featured or non-featured versions only |
None
|
types |
Literal['release', 'beta', 'alpha']
|
The release type of version |
None
|
auth |
str
|
An optional authorization token to use when getting the project versions |
None
|
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested project wasn't found or no authorization to see this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
list[Project.Version]
|
The versions that were found |
Source code in src/pyrinth/projects.py
modify(slug=None, title=None, description=None, categories=None, client_side=None, server_side=None, body=None, additional_categories=None, issues_url=None, source_url=None, wiki_url=None, discord_url=None, license_id=None, license_url=None, status=None, requested_status=None, moderation_message=None, moderation_message_body=None, auth=None)
Modify the project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
slug |
str
|
The slug of a project, used for vanity URLs. Regex: ^[\w!@\(()`.+,"\-']{3,64}\) |
None
|
title |
str
|
The title or name of the project |
None
|
description |
str
|
A short description of the project |
None
|
categories |
list[str]
|
A list of categories that the project has |
None
|
client_side |
str
|
The client side support of the project |
None
|
server_side |
str
|
The server side support of the project |
None
|
body |
str
|
A long form description of the project |
None
|
additional_categories |
list[str]
|
A list of categories which are searchable but non-primary |
None
|
issues_url |
str
|
An optional link to where to submit bugs or issues with the project |
None
|
source_url |
str
|
An optional link to the source code of the project |
None
|
wiki_url |
str
|
An optional link to the project's wiki page or other relevant information |
None
|
discord_url |
str
|
An optional invite link to the project's discord |
None
|
license_id |
str
|
The SPDX license ID of a project |
None
|
license_url |
str
|
The URL to this license |
None
|
status |
Literal['approved', 'archived', 'rejected', 'draft', 'unlisted', 'processing', 'withheld', 'scheduled', 'private', 'unknown']
|
The status of the project |
None
|
requested_status |
Literal['approved', 'archived', 'unlisted', 'private', 'draft']
|
The requested status when submitting for review or scheduling the project for release |
None
|
moderation_message |
str
|
The title of the moderators' message for the project |
None
|
moderation_message_body |
str
|
The body of the moderators' message for the project |
None
|
auth |
str
|
Authentication token to use when modifying the project |
None
|
Raises:
Type | Description |
---|---|
InvalidParamError
|
Please specify at least 1 optional argument |
NoAuthorizationError
|
No authorization to modify this project |
NotFoundError
|
The requested project wasn't found or no authorization to see this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
Whether the project modification was successful |
Source code in src/pyrinth/projects.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 |
|
modify_gallery_image(url, featured=None, title=None, description=None, ordering=None, auth=None)
Modify a gallery image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
URL link of the image to modify |
required |
featured |
bool
|
Whether the image is featured |
None
|
title |
str
|
New title of the image |
None
|
description |
str
|
New description of the image |
None
|
ordering |
int
|
New ordering of the image |
None
|
auth |
str
|
Authentication token when modifying the gallery image |
None
|
Raises:
Type | Description |
---|---|
NoAuthorizationError
|
No authorization to edit this gallery image |
NotFoundError
|
The requested project wasn't found or no authorization to see this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
bool
|
Whether the gallery image modification was successful |
Source code in src/pyrinth/projects.py
search(query='', facets=None, index='relevance', offset=0, limit=10, filters=None)
staticmethod
Search for projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
The query to search for |
''
|
facets |
list[list[str]]
|
The recommended way of filtering search results. Learn more about using facets |
None
|
index |
Literal['relevance', 'downloads', 'follows', 'newest', 'updated']
|
The sorting method used for sorting search results |
'relevance'
|
offset |
int
|
The offset into the search. Skip this number of results |
0
|
limit |
int
|
The number of results returned by the search |
10
|
filters |
list[str]
|
A list of filters relating to the properties of a project. Use filters when there isn't an available facet for your needs. More information |
None
|
Raises:
Type | Description |
---|---|
NotFoundError
|
The requested project wasn't found or no authorization to see this project |
InvalidRequestError
|
Invalid request |
Returns:
Type | Description |
---|---|
list[Project.SearchResult]
|
The project search results |
Source code in src/pyrinth/projects.py
Used for users.
User
Source code in src/pyrinth/users.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
|
create_project(project_model, icon=None)
Create a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_model |
ProjectModel
|
The model of the project to create |
required |
icon |
str
|
The path of the icon to use for the newly created project |
None
|
Returns:
Type | Description |
---|---|
int
|
If the project creation was successful |
Source code in src/pyrinth/users.py
follow_project(id)
Follow a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
The ID of the project to follow |
required |
Returns:
Type | Description |
---|---|
int
|
If the project follow was successful |
Source code in src/pyrinth/users.py
from_id(id)
staticmethod
Get a user from ID.
Returns (User): The user that was found using the ID
Source code in src/pyrinth/users.py
from_ids(ids)
staticmethod
Get a users from IDs.
Returns:
Type | Description |
---|---|
User
|
The users that were found using the IDs |
Source code in src/pyrinth/users.py
get(id, auth=None)
staticmethod
Get a user.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
The user's ID to find |
required |
auth |
str
|
The authorization token to use when creating the user. Defaults to None |
None
|
Raises:
Type | Description |
---|---|
NotFoundError
|
The user was not found |
InvalidRequestError
|
An invalid API call was sent |
Returns:
Type | Description |
---|---|
User
|
The user that was found |
Source code in src/pyrinth/users.py
get_from_auth(auth)
staticmethod
Get a user from authorization token.
Returns:
Type | Description |
---|---|
User
|
The user that was found using the authorization token |
Source code in src/pyrinth/users.py
unfollow_project(id)
Unfollow a project.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
id |
str
|
The ID of the project to unfollow |
required |
Returns:
Type | Description |
---|---|
int
|
If the project unfollow was successful |