From 6f259d15eccec0d82523543af5e46ff3ae897640 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 22 Jun 2020 19:27:11 +0200 Subject: [PATCH] publish: 5.9.2 --- poetry.lock | 109 +++++++++--------- pyproject.toml | 4 +- royalpack/stars/__init__.py | 36 ++---- royalpack/stars/api_bio.py | 45 ++++++++ royalpack/stars/api_bio_get.py | 22 ---- royalpack/stars/api_bio_set.py | 33 ------ royalpack/stars/api_cvstats_avg.py | 7 +- royalpack/stars/api_cvstats_latest.py | 7 +- .../{api_diario_get.py => api_diario.py} | 16 ++- royalpack/stars/api_diario_list.py | 13 ++- royalpack/stars/api_diario_random.py | 9 +- royalpack/stars/api_discord_cv.py | 8 +- royalpack/stars/api_discord_play.py | 15 ++- .../{api_fiorygi_get.py => api_fiorygi.py} | 20 ++-- royalpack/stars/api_poll.py | 63 ++++++++++ .../{api_polls_list.py => api_poll_list.py} | 13 +-- royalpack/stars/api_polls_create.py | 41 ------- royalpack/stars/api_polls_get.py | 34 ------ royalpack/stars/api_user_get_ryg.py | 42 ------- .../{api_user_find_ryg.py => api_user_ryg.py} | 33 ++++-- royalpack/stars/api_wiki_edit.py | 64 ---------- royalpack/stars/api_wiki_get.py | 30 ----- royalpack/stars/api_wiki_list.py | 19 --- royalpack/utils/__init__.py | 2 - royalpack/utils/finduser.py | 19 --- 25 files changed, 250 insertions(+), 454 deletions(-) create mode 100644 royalpack/stars/api_bio.py delete mode 100644 royalpack/stars/api_bio_get.py delete mode 100644 royalpack/stars/api_bio_set.py rename royalpack/stars/{api_diario_get.py => api_diario.py} (53%) rename royalpack/stars/{api_fiorygi_get.py => api_fiorygi.py} (66%) create mode 100644 royalpack/stars/api_poll.py rename royalpack/stars/{api_polls_list.py => api_poll_list.py} (71%) delete mode 100644 royalpack/stars/api_polls_create.py delete mode 100644 royalpack/stars/api_polls_get.py delete mode 100644 royalpack/stars/api_user_get_ryg.py rename royalpack/stars/{api_user_find_ryg.py => api_user_ryg.py} (52%) delete mode 100644 royalpack/stars/api_wiki_edit.py delete mode 100644 royalpack/stars/api_wiki_get.py delete mode 100644 royalpack/stars/api_wiki_list.py delete mode 100644 royalpack/utils/finduser.py diff --git a/poetry.lock b/poetry.lock index 23f7ebe0..34ff1acb 100644 --- a/poetry.lock +++ b/poetry.lock @@ -67,7 +67,7 @@ description = "Python package for providing Mozilla's CA Bundle." name = "certifi" optional = false python-versions = "*" -version = "2020.4.5.1" +version = "2020.6.20" [[package]] category = "main" @@ -145,7 +145,7 @@ description = "Date parsing library designed to parse dates from HTML pages" name = "dateparser" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.7.4" +version = "0.7.6" [package.dependencies] python-dateutil = "*" @@ -269,7 +269,7 @@ description = "Internationalized Domain Names in Applications (IDNA)" name = "idna" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.8" +version = "2.9" [[package]] category = "main" @@ -403,24 +403,24 @@ description = "Alternative regular expression module, to replace re." name = "regex" optional = false python-versions = "*" -version = "2020.5.14" +version = "2020.6.8" [[package]] category = "main" description = "Python HTTP for Humans." name = "requests" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.21.0" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "2.24.0" [package.dependencies] certifi = ">=2017.4.17" -chardet = ">=3.0.2,<3.1.0" -idna = ">=2.5,<2.9" -urllib3 = ">=1.21.1,<1.25" +chardet = ">=3.0.2,<4" +idna = ">=2.5,<3" +urllib3 = ">=1.21.1,<1.25.0 || >1.25.0,<1.25.1 || >1.25.1,<1.26" [package.extras] -security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)"] +security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] [[package]] @@ -443,7 +443,7 @@ description = "A multipurpose bot and web framework" name = "royalnet" optional = false python-versions = ">=3.8,<4.0" -version = "5.8.13" +version = "5.9.1" [package.dependencies] dateparser = ">=0.7.2,<0.8.0" @@ -600,12 +600,12 @@ description = "Module for interacting with various Steam features" name = "steam" optional = false python-versions = "*" -version = "1.0.1" +version = "1.0.2" [package.dependencies] cachetools = ">=3.0.0" pycryptodomex = ">=3.7.0" -requests = ">=2.9.1,<2.22.0" +requests = ">=2.9.1" six = ">=1.10" vdf = ">=3.3" @@ -644,11 +644,12 @@ category = "main" description = "HTTP library with thread-safe connection pooling, file post, and more." name = "urllib3" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4" -version = "1.24.3" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" +version = "1.25.9" [package.extras] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +brotli = ["brotlipy (>=0.6.0)"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"] socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] [[package]] @@ -709,10 +710,10 @@ description = "YouTube video downloader" name = "youtube-dl" optional = false python-versions = "*" -version = "2020.6.6" +version = "2020.6.16.1" [metadata] -content-hash = "9245b7ae163a3746554cd31e3b20294d26aa3534cc78303a419ac54850db55cb" +content-hash = "2e70b5afc7b2a39eb6a79be841489343c689c49f5a1f60659df93ca44cc0382e" python-versions = "^3.8" [metadata.files] @@ -763,8 +764,8 @@ cachetools = [ {file = "cachetools-4.1.0.tar.gz", hash = "sha256:1d057645db16ca7fe1f3bd953558897603d6f0b9c51ed9d11eb4d071ec4e2aab"}, ] certifi = [ - {file = "certifi-2020.4.5.1-py2.py3-none-any.whl", hash = "sha256:1d987a998c75633c40847cc966fcf5904906c920a7f17ef374f5aa4282abd304"}, - {file = "certifi-2020.4.5.1.tar.gz", hash = "sha256:51fcb31174be6e6664c5f69e3e1691a2d72a1a12e90f872cbdb1567eb47b6519"}, + {file = "certifi-2020.6.20-py2.py3-none-any.whl", hash = "sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"}, + {file = "certifi-2020.6.20.tar.gz", hash = "sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3"}, ] cffi = [ {file = "cffi-1.14.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:1cae98a7054b5c9391eb3249b86e0e99ab1e02bb0cc0575da191aedadbdf4384"}, @@ -834,8 +835,8 @@ cryptography = [ {file = "cryptography-2.9.2.tar.gz", hash = "sha256:a0c30272fb4ddda5f5ffc1089d7405b7a71b0b0f51993cb4e5dbb4590b2fc229"}, ] dateparser = [ - {file = "dateparser-0.7.4-py2.py3-none-any.whl", hash = "sha256:1b1f0e3034f82d1f92b45fa445826da6a36d67af8a1169e04869685594276011"}, - {file = "dateparser-0.7.4.tar.gz", hash = "sha256:fb5bfde4795fa4b179fe05c2c25b3981f785de26bec37e247dee1079c63d5689"}, + {file = "dateparser-0.7.6-py2.py3-none-any.whl", hash = "sha256:7552c994f893b5cb8fcf103b4cd2ff7f57aab9bfd2619fdf0cf571c0740fd90b"}, + {file = "dateparser-0.7.6.tar.gz", hash = "sha256:e875efd8c57c85c2d02b238239878db59ff1971f5a823457fcc69e493bf6ebfa"}, ] decorator = [ {file = "decorator-4.4.2-py2.py3-none-any.whl", hash = "sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760"}, @@ -877,8 +878,8 @@ humanfriendly = [ {file = "humanfriendly-8.2.tar.gz", hash = "sha256:bf52ec91244819c780341a3438d5d7b09f431d3f113a475147ac9b7b167a3d12"}, ] idna = [ - {file = "idna-2.8-py2.py3-none-any.whl", hash = "sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c"}, - {file = "idna-2.8.tar.gz", hash = "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407"}, + {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"}, + {file = "idna-2.9.tar.gz", hash = "sha256:7588d1c14ae4c77d74036e8c22ff447b26d0fde8f007354fd48a7814db15b7cb"}, ] multidict = [ {file = "multidict-4.7.6-cp35-cp35m-macosx_10_14_x86_64.whl", hash = "sha256:275ca32383bc5d1894b6975bb4ca6a7ff16ab76fa622967625baeebcf8079000"}, @@ -1014,39 +1015,39 @@ pytz = [ {file = "pytz-2020.1.tar.gz", hash = "sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048"}, ] regex = [ - {file = "regex-2020.5.14-cp27-cp27m-win32.whl", hash = "sha256:e565569fc28e3ba3e475ec344d87ed3cd8ba2d575335359749298a0899fe122e"}, - {file = "regex-2020.5.14-cp27-cp27m-win_amd64.whl", hash = "sha256:d466967ac8e45244b9dfe302bbe5e3337f8dc4dec8d7d10f5e950d83b140d33a"}, - {file = "regex-2020.5.14-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:27ff7325b297fb6e5ebb70d10437592433601c423f5acf86e5bc1ee2919b9561"}, - {file = "regex-2020.5.14-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:ea55b80eb0d1c3f1d8d784264a6764f931e172480a2f1868f2536444c5f01e01"}, - {file = "regex-2020.5.14-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:c9bce6e006fbe771a02bda468ec40ffccbf954803b470a0345ad39c603402577"}, - {file = "regex-2020.5.14-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:d881c2e657c51d89f02ae4c21d9adbef76b8325fe4d5cf0e9ad62f850f3a98fd"}, - {file = "regex-2020.5.14-cp36-cp36m-win32.whl", hash = "sha256:99568f00f7bf820c620f01721485cad230f3fb28f57d8fbf4a7967ec2e446994"}, - {file = "regex-2020.5.14-cp36-cp36m-win_amd64.whl", hash = "sha256:70c14743320a68c5dac7fc5a0f685be63bc2024b062fe2aaccc4acc3d01b14a1"}, - {file = "regex-2020.5.14-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:a7c37f048ec3920783abab99f8f4036561a174f1314302ccfa4e9ad31cb00eb4"}, - {file = "regex-2020.5.14-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:89d76ce33d3266173f5be80bd4efcbd5196cafc34100fdab814f9b228dee0fa4"}, - {file = "regex-2020.5.14-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:51f17abbe973c7673a61863516bdc9c0ef467407a940f39501e786a07406699c"}, - {file = "regex-2020.5.14-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:ce5cc53aa9fbbf6712e92c7cf268274eaff30f6bd12a0754e8133d85a8fb0f5f"}, - {file = "regex-2020.5.14-cp37-cp37m-win32.whl", hash = "sha256:8044d1c085d49673aadb3d7dc20ef5cb5b030c7a4fa253a593dda2eab3059929"}, - {file = "regex-2020.5.14-cp37-cp37m-win_amd64.whl", hash = "sha256:c2062c7d470751b648f1cacc3f54460aebfc261285f14bc6da49c6943bd48bdd"}, - {file = "regex-2020.5.14-cp38-cp38-manylinux1_i686.whl", hash = "sha256:329ba35d711e3428db6b45a53b1b13a0a8ba07cbbcf10bbed291a7da45f106c3"}, - {file = "regex-2020.5.14-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:579ea215c81d18da550b62ff97ee187b99f1b135fd894a13451e00986a080cad"}, - {file = "regex-2020.5.14-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:3a9394197664e35566242686d84dfd264c07b20f93514e2e09d3c2b3ffdf78fe"}, - {file = "regex-2020.5.14-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:ce367d21f33e23a84fb83a641b3834dd7dd8e9318ad8ff677fbfae5915a239f7"}, - {file = "regex-2020.5.14-cp38-cp38-win32.whl", hash = "sha256:1386e75c9d1574f6aa2e4eb5355374c8e55f9aac97e224a8a5a6abded0f9c927"}, - {file = "regex-2020.5.14-cp38-cp38-win_amd64.whl", hash = "sha256:7e61be8a2900897803c293247ef87366d5df86bf701083b6c43119c7c6c99108"}, - {file = "regex-2020.5.14.tar.gz", hash = "sha256:ce450ffbfec93821ab1fea94779a8440e10cf63819be6e176eb1973a6017aff5"}, + {file = "regex-2020.6.8-cp27-cp27m-win32.whl", hash = "sha256:fbff901c54c22425a5b809b914a3bfaf4b9570eee0e5ce8186ac71eb2025191c"}, + {file = "regex-2020.6.8-cp27-cp27m-win_amd64.whl", hash = "sha256:112e34adf95e45158c597feea65d06a8124898bdeac975c9087fe71b572bd938"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:92d8a043a4241a710c1cf7593f5577fbb832cf6c3a00ff3fc1ff2052aff5dd89"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:bae83f2a56ab30d5353b47f9b2a33e4aac4de9401fb582b55c42b132a8ac3868"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:b2ba0f78b3ef375114856cbdaa30559914d081c416b431f2437f83ce4f8b7f2f"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:95fa7726d073c87141f7bbfb04c284901f8328e2d430eeb71b8ffdd5742a5ded"}, + {file = "regex-2020.6.8-cp36-cp36m-win32.whl", hash = "sha256:e3cdc9423808f7e1bb9c2e0bdb1c9dc37b0607b30d646ff6faf0d4e41ee8fee3"}, + {file = "regex-2020.6.8-cp36-cp36m-win_amd64.whl", hash = "sha256:c78e66a922de1c95a208e4ec02e2e5cf0bb83a36ceececc10a72841e53fbf2bd"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:08997a37b221a3e27d68ffb601e45abfb0093d39ee770e4257bd2f5115e8cb0a"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:2f6f211633ee8d3f7706953e9d3edc7ce63a1d6aad0be5dcee1ece127eea13ae"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:55b4c25cbb3b29f8d5e63aeed27b49fa0f8476b0d4e1b3171d85db891938cc3a"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:89cda1a5d3e33ec9e231ece7307afc101b5217523d55ef4dc7fb2abd6de71ba3"}, + {file = "regex-2020.6.8-cp37-cp37m-win32.whl", hash = "sha256:690f858d9a94d903cf5cada62ce069b5d93b313d7d05456dbcd99420856562d9"}, + {file = "regex-2020.6.8-cp37-cp37m-win_amd64.whl", hash = "sha256:1700419d8a18c26ff396b3b06ace315b5f2a6e780dad387e4c48717a12a22c29"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux1_i686.whl", hash = "sha256:654cb773b2792e50151f0e22be0f2b6e1c3a04c5328ff1d9d59c0398d37ef610"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:52e1b4bef02f4040b2fd547357a170fc1146e60ab310cdbdd098db86e929b387"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:cf59bbf282b627130f5ba68b7fa3abdb96372b24b66bdf72a4920e8153fc7910"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:5aaa5928b039ae440d775acea11d01e42ff26e1561c0ffcd3d805750973c6baf"}, + {file = "regex-2020.6.8-cp38-cp38-win32.whl", hash = "sha256:97712e0d0af05febd8ab63d2ef0ab2d0cd9deddf4476f7aa153f76feef4b2754"}, + {file = "regex-2020.6.8-cp38-cp38-win_amd64.whl", hash = "sha256:6ad8663c17db4c5ef438141f99e291c4d4edfeaacc0ce28b5bba2b0bf273d9b5"}, + {file = "regex-2020.6.8.tar.gz", hash = "sha256:e9b64e609d37438f7d6e68c2546d2cb8062f3adb27e6336bc129b51be20773ac"}, ] requests = [ - {file = "requests-2.21.0-py2.py3-none-any.whl", hash = "sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b"}, - {file = "requests-2.21.0.tar.gz", hash = "sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e"}, + {file = "requests-2.24.0-py2.py3-none-any.whl", hash = "sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"}, + {file = "requests-2.24.0.tar.gz", hash = "sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b"}, ] riotwatcher = [ {file = "riotwatcher-2.7.1-py2.py3-none-any.whl", hash = "sha256:3fb03b20f768cea7830d54c6d301a8341c67223625ac8536d26d1c140af3dcb0"}, {file = "riotwatcher-2.7.1.tar.gz", hash = "sha256:5349271c7e00637b7619491a6070e66603705db60558ea2a690e7016f6e6d9a4"}, ] royalnet = [ - {file = "royalnet-5.8.13-py3-none-any.whl", hash = "sha256:77bc201477db59e172caae049ba5edac5de7134cef5ef03d113636e4b9fd4f83"}, - {file = "royalnet-5.8.13.tar.gz", hash = "sha256:42c8772e03bdd9400990f853fe477d09759c547da2d300df536cd49f42159203"}, + {file = "royalnet-5.9.1-py3-none-any.whl", hash = "sha256:be5998c80d261d774ac7f70931cacb09c3e843ad838529aec51be54dc7091027"}, + {file = "royalnet-5.9.1.tar.gz", hash = "sha256:e1296389277b0773d2a0b73497165f869e413a22bcc046538b9030efd9090be2"}, ] royalspells = [ {file = "royalspells-3.2.tar.gz", hash = "sha256:2bd4a9a66514532e35c02c3907425af48c7cb292364c4843c795719a82b25dfe"}, @@ -1093,7 +1094,7 @@ starlette = [ {file = "starlette-0.12.13.tar.gz", hash = "sha256:9597bc28e3c4659107c1c4a45ec32dc45e947d78fe56230222be673b2c36454a"}, ] steam = [ - {file = "steam-1.0.1.tar.gz", hash = "sha256:7a2635dc46a18a86f608c8b9f8e042126cf9bd7b8e8e9ca6dcacb0998cb56ec5"}, + {file = "steam-1.0.2.tar.gz", hash = "sha256:ca7c026848338ca2a004c0cb73d362c94e5c1a74815c8605d34fce3a6662f9c0"}, ] toml = [ {file = "toml-0.10.1-py2.py3-none-any.whl", hash = "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"}, @@ -1115,8 +1116,8 @@ tzlocal = [ {file = "tzlocal-2.1.tar.gz", hash = "sha256:643c97c5294aedc737780a49d9df30889321cbe1204eac2c2ec6134035a92e44"}, ] urllib3 = [ - {file = "urllib3-1.24.3-py2.py3-none-any.whl", hash = "sha256:a637e5fae88995b256e3409dc4d52c2e2e0ba32c42a6365fee8bbd2238de3cfb"}, - {file = "urllib3-1.24.3.tar.gz", hash = "sha256:2393a695cd12afedd0dcb26fe5d50d0cf248e5a66f75dbd89a3d4eb333a61af4"}, + {file = "urllib3-1.25.9-py2.py3-none-any.whl", hash = "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"}, + {file = "urllib3-1.25.9.tar.gz", hash = "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527"}, ] uvicorn = [ {file = "uvicorn-0.10.9-py3-none-any.whl", hash = "sha256:dc7119b28e15c4c737315c5a570081b0a5a7d8d5c1e8a70a7be70043d88b23a7"}, @@ -1181,6 +1182,6 @@ yarl = [ {file = "yarl-1.4.2.tar.gz", hash = "sha256:58cd9c469eced558cd81aa3f484b2924e8897049e06889e8ff2510435b7ef74b"}, ] youtube-dl = [ - {file = "youtube_dl-2020.6.6-py2.py3-none-any.whl", hash = "sha256:813310fb7ab265c379e9aebb2bd6cde6995f9a8f22a06d2ff81c05dfab7da864"}, - {file = "youtube_dl-2020.6.6.tar.gz", hash = "sha256:74e6cc7395060fc39f0b8e21c1e4707486da904c96145bd875187bda2da83b04"}, + {file = "youtube_dl-2020.6.16.1-py2.py3-none-any.whl", hash = "sha256:e54b307048bb18164729fb278013af6d5477c69c3d995147205a16f22a61296b"}, + {file = "youtube_dl-2020.6.16.1.tar.gz", hash = "sha256:9fc0389a1bbbeb609a5bb4ad5630dea107a9d1a24c73721c611a78c234309a75"}, ] diff --git a/pyproject.toml b/pyproject.toml index f3000f41..e15ff564 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ [tool.poetry] name = "royalpack" - version = "5.8.23" + version = "5.9.0" description = "A Royalnet command pack for the Royal Games community" authors = ["Stefano Pigozzi "] license = "AGPL-3.0+" @@ -25,7 +25,7 @@ steam = "*" [tool.poetry.dependencies.royalnet] - version = "~5.8.14" + version = "~5.9.2" # Maybe... there is a way to make these selectable? extras = [ "telegram", diff --git a/royalpack/stars/__init__.py b/royalpack/stars/__init__.py index 6137b1cc..7f6ec461 100644 --- a/royalpack/stars/__init__.py +++ b/royalpack/stars/__init__.py @@ -1,43 +1,31 @@ # Imports go here! -from .api_bio_get import ApiBioGetStar -from .api_bio_set import ApiBioSetStar -from .api_diario_get import ApiDiarioGetStar -from .api_diario_list import ApiDiarioListStar +from .api_bio import ApiBioSetStar +from .api_diario import ApiDiarioGetStar +from .api_diario_list import ApiDiarioPagesStar from .api_discord_cv import ApiDiscordCvStar from .api_discord_play import ApiDiscordPlayStar -from .api_wiki_edit import ApiWikiEditStar -from .api_wiki_get import ApiWikiGetStar -from .api_wiki_list import ApiWikiListStar -from .api_fiorygi_get import ApiFiorygiGetStar +from .api_fiorygi import ApiFiorygiStar from .api_diario_random import ApiDiarioRandomStar -from .api_polls_create import ApiPollsCreate -from .api_polls_get import ApiPollsGet -from .api_polls_list import ApiPollsList +from .api_poll import ApiPollStar +from .api_poll_list import ApiPollsListStar from .api_cvstats_latest import ApiCvstatsLatestStar from .api_cvstats_avg import ApiCvstatsAvgStar -from .api_user_get_ryg import ApiUserGetRygStar -from .api_user_find_ryg import ApiUserFindRygStar +from .api_user_ryg import ApiUserRygStar # Enter the PageStars of your Pack here! available_page_stars = [ - ApiBioGetStar, ApiBioSetStar, ApiDiarioGetStar, - ApiDiarioListStar, + ApiDiarioPagesStar, ApiDiscordCvStar, ApiDiscordPlayStar, - ApiWikiEditStar, - ApiWikiGetStar, - ApiWikiListStar, - ApiFiorygiGetStar, + ApiFiorygiStar, ApiDiarioRandomStar, - ApiPollsCreate, - ApiPollsGet, - ApiPollsList, + ApiPollStar, + ApiPollsListStar, ApiCvstatsLatestStar, ApiCvstatsAvgStar, - ApiUserGetRygStar, - ApiUserFindRygStar, + ApiUserRygStar, ] # Don't change this, it should automatically generate __all__ diff --git a/royalpack/stars/api_bio.py b/royalpack/stars/api_bio.py new file mode 100644 index 00000000..32b2baf4 --- /dev/null +++ b/royalpack/stars/api_bio.py @@ -0,0 +1,45 @@ +import royalnet.utils as ru +from royalnet.backpack.tables import * +from royalnet.constellation.api import * +from ..tables import Bio + + +class ApiBioSetStar(ApiStar): + path = "/api/bio/v2" + + methods = ["GET", "PUT"] + + parameters = { + "get": { + "uid": "The id of the user to get the bio of." + }, + "put": { + "contents": "The contents of the bio." + } + } + + auth = { + "get": False, + "put": True, + } + + tags = ["bio"] + + async def get(self, data: ApiData) -> ru.JSON: + """Get the bio of a specific user.""" + user = await User.find(self.alchemy, data.session, data.int("uid")) + return user.bio.json() if user.bio else None + + async def put(self, data: ApiData) -> ru.JSON: + """Set the bio of current user.""" + contents = data["contents"] + BioT = self.alchemy.get(Bio) + user = await data.user() + bio = user.bio + if bio is None: + bio = BioT(user=user, contents=contents) + data.session.add(bio) + else: + bio.contents = contents + await data.session_commit() + return bio.json() diff --git a/royalpack/stars/api_bio_get.py b/royalpack/stars/api_bio_get.py deleted file mode 100644 index 97d71112..00000000 --- a/royalpack/stars/api_bio_get.py +++ /dev/null @@ -1,22 +0,0 @@ -from royalnet.utils import * -from royalnet.backpack.tables import * -from royalnet.constellation.api import * -from ..utils import find_user_api - - -class ApiBioGetStar(ApiStar): - path = "/api/bio/get/v1" - - summary = "Get the bio of a Royalnet user." - - parameters = { - "id": "The user to get the bio of." - } - - tags = ["bio"] - - async def api(self, data: ApiData) -> dict: - user = await find_user_api(data["id"], self.alchemy, data.session) - if user.bio is None: - raise NotFoundError("User has no bio set.") - return user.bio.json() diff --git a/royalpack/stars/api_bio_set.py b/royalpack/stars/api_bio_set.py deleted file mode 100644 index 49285ae8..00000000 --- a/royalpack/stars/api_bio_set.py +++ /dev/null @@ -1,33 +0,0 @@ -import royalnet.utils as ru -from royalnet.backpack.tables import * -from royalnet.constellation.api import * -from ..tables import Bio - - -class ApiBioSetStar(ApiStar): - path = "/api/bio/set/v1" - - methods = ["PUT"] - - summary = "Set the bio of the logged in Royalnet user." - - parameters = { - "contents": "The contents of the bio." - } - - requires_auth = True - - tags = ["bio"] - - async def api(self, data: ApiData) -> ru.JSON: - contents = data["contents"] - BioT = self.alchemy.get(Bio) - user = await data.user() - bio = user.bio - if bio is None: - bio = BioT(user=user, contents=contents) - data.session.add(bio) - else: - bio.contents = contents - await data.session_commit() - return bio.json() diff --git a/royalpack/stars/api_cvstats_avg.py b/royalpack/stars/api_cvstats_avg.py index d4f78901..a9ccb6dd 100644 --- a/royalpack/stars/api_cvstats_avg.py +++ b/royalpack/stars/api_cvstats_avg.py @@ -7,13 +7,10 @@ from ..tables import Cvstats class ApiCvstatsAvgStar(ApiStar): path = "/api/cvstats/avg/v1" - methods = ["GET"] - - summary = "Get some averages on the cvstats." - tags = ["cvstats"] - async def api(self, data: ApiData) -> ru.JSON: + async def get(self, data: ApiData) -> ru.JSON: + """Get some averages on the cvstats.""" results = data.session.execute(""" SELECT * FROM ( diff --git a/royalpack/stars/api_cvstats_latest.py b/royalpack/stars/api_cvstats_latest.py index a2530339..16558d9e 100644 --- a/royalpack/stars/api_cvstats_latest.py +++ b/royalpack/stars/api_cvstats_latest.py @@ -7,13 +7,10 @@ from ..tables import Cvstats class ApiCvstatsLatestStar(ApiStar): path = "/api/cvstats/latest/v1" - methods = ["GET"] - - summary = "Get the latest 500 cvstats." - tags = ["cvstats"] - async def api(self, data: ApiData) -> ru.JSON: + async def get(self, data: ApiData) -> ru.JSON: + """Get the latest 500 cvstats recorded.""" CvstatsT = self.alchemy.get(Cvstats) cvstats = data.session.query(CvstatsT).order_by(CvstatsT.timestamp.desc()).limit(500).all() diff --git a/royalpack/stars/api_diario_get.py b/royalpack/stars/api_diario.py similarity index 53% rename from royalpack/stars/api_diario_get.py rename to royalpack/stars/api_diario.py index a0976edb..0347a080 100644 --- a/royalpack/stars/api_diario_get.py +++ b/royalpack/stars/api_diario.py @@ -4,21 +4,19 @@ from ..tables import * class ApiDiarioGetStar(ApiStar): - path = "/api/diario/get/v1" - - summary = "Get the diario entry with a specific id." + path = "/api/diario/v2" parameters = { - "id": "The id of the diario entry to get." + "get": { + "id": "The id of the diario entry to get." + } } tags = ["diario"] - async def api(self, data: ApiData) -> dict: - try: - diario_id = int(data["id"]) - except ValueError: - raise InvalidParameterError("'id' is not a valid int.") + async def get(self, data: ApiData) -> JSON: + """Get a specific diario entry.""" + diario_id = data.int("id") entry: Diario = await asyncify(data.session.query(self.alchemy.get(Diario)).get, diario_id) if entry is None: raise NotFoundError("No such diario entry.") diff --git a/royalpack/stars/api_diario_list.py b/royalpack/stars/api_diario_list.py index 0ca2b96b..3e20b75b 100644 --- a/royalpack/stars/api_diario_list.py +++ b/royalpack/stars/api_diario_list.py @@ -4,18 +4,19 @@ from royalnet.utils import * from ..tables import * -class ApiDiarioListStar(ApiStar): - path = "/api/diario/list/v1" - - summary = "Get a list of up to 500 diario entries." +class ApiDiarioPagesStar(ApiStar): + path = "/api/diario/pages/v1" parameters = { - "page": "The diario page you want to get. Can be negative to get the entries in reverse order." + "get": { + "page": "The diario page you want to get. Can be negative to get the entries in reverse order." + } } tags = ["diario"] - async def api(self, data: ApiData) -> dict: + async def get(self, data: ApiData) -> JSON: + """Get a diario page made of up to 500 diario entries.""" page_str = data["page"] try: page = int(page_str) diff --git a/royalpack/stars/api_diario_random.py b/royalpack/stars/api_diario_random.py index 3a2fc413..84540d58 100644 --- a/royalpack/stars/api_diario_random.py +++ b/royalpack/stars/api_diario_random.py @@ -8,15 +8,16 @@ from sqlalchemy import func class ApiDiarioRandomStar(ApiStar): path = "/api/diario/random/v1" - summary = "Get random diario entries." - parameters = { - "amount": "The number of diario entries to get." + "get": { + "amount": "The number of diario entries to get." + } } tags = ["diario"] - async def api(self, data: ApiData) -> JSON: + async def get(self, data: ApiData) -> JSON: + """Get random diario entries.""" DiarioT = self.alchemy.get(Diario) try: amount = int(data["amount"]) diff --git a/royalpack/stars/api_discord_cv.py b/royalpack/stars/api_discord_cv.py index ac4d49de..36e2f201 100644 --- a/royalpack/stars/api_discord_cv.py +++ b/royalpack/stars/api_discord_cv.py @@ -1,13 +1,15 @@ +import royalnet.utils as ru from royalnet.constellation.api import * class ApiDiscordCvStar(ApiStar): path = "/api/discord/cv/v1" - summary = "Get the members status of a single Discord guild. Equivalent to calling /cv in a chat." - tags = ["discord"] - async def api(self, data: ApiData) -> dict: + async def get(self, data: ApiData) -> ru.JSON: + """Get the members status of a single Discord guild. + + Equivalent to calling /cv in a chat.""" response = await self.interface.call_herald_event("discord", "discord_cv") return response diff --git a/royalpack/stars/api_discord_play.py b/royalpack/stars/api_discord_play.py index 47d0bf6a..4a869839 100644 --- a/royalpack/stars/api_discord_play.py +++ b/royalpack/stars/api_discord_play.py @@ -7,19 +7,22 @@ log = logging.getLogger(__name__) class ApiDiscordPlayStar(ApiStar): - path = "/api/discord/play/v1" + path = "/api/discord/play/v2" - summary = "Add a audio file to the RoyalQueue of a Discord Guild." + methods = ["POST"] parameters = { - "url": "The url of the audio file to add.", - "user": "The name to display in the File Added message.", - "guild_id": "The id of the guild owning the RoyalQueue to add the audio file to." + "post": { + "url": "The url of the audio file to add.", + "user": "The name to display in the File Added message.", + "guild_id": "The id of the guild owning the RoyalQueue to add the audio file to.", + } } tags = ["discord"] - async def api(self, data: ApiData) -> dict: + async def post(self, data: ApiData) -> dict: + """Add a audio file to the RoyalQueue of a Discord Guild.""" url = data["url"] user = data.get("user") guild_id_str = data.get("guild_id") diff --git a/royalpack/stars/api_fiorygi_get.py b/royalpack/stars/api_fiorygi.py similarity index 66% rename from royalpack/stars/api_fiorygi_get.py rename to royalpack/stars/api_fiorygi.py index 5e31e9b9..a8da8d35 100644 --- a/royalpack/stars/api_fiorygi_get.py +++ b/royalpack/stars/api_fiorygi.py @@ -2,23 +2,23 @@ from typing import * from royalnet.utils import * from royalnet.backpack.tables import * from royalnet.constellation.api import * -from ..utils import find_user_api -from ..tables import Fiorygi, FiorygiTransaction +from ..tables import Fiorygi -class ApiFiorygiGetStar(ApiStar): - path = "/api/user/fiorygi/get/v1" - - summary = "Get the fiorygi of a Royalnet user." +class ApiFiorygiStar(ApiStar): + path = "/api/fiorygi/v2" parameters = { - "id": "The user to get the fiorygi of." + "get": { + "uid": "The user to get the fiorygi of." + } } - tags = ["user"] + tags = ["fiorygi"] - async def api(self, data: ApiData) -> JSON: - user: User = await find_user_api(data["id"], self.alchemy, data.session) + async def get(self, data: ApiData) -> JSON: + """Get fiorygi information about a specific user.""" + user = await User.find(self.alchemy, data.session, data.int("uid")) if user.fiorygi is None: return { "fiorygi": 0, diff --git a/royalpack/stars/api_poll.py b/royalpack/stars/api_poll.py new file mode 100644 index 00000000..4426fa19 --- /dev/null +++ b/royalpack/stars/api_poll.py @@ -0,0 +1,63 @@ +from typing import * +import datetime +import uuid +from royalnet.utils import * +from royalnet.constellation.api import * +from ..tables import Poll + + +class ApiPollStar(ApiStar): + path = "/api/poll/v2" + + parameters = { + "get": { + "uuid": "The UUID of the poll to get.", + }, + "post": { + "question": "The question to ask in the poll.", + "description": "A longer Markdown-formatted description.", + "expires": "A ISO timestamp of the expiration date for the poll.", + } + } + + auth = { + "get": False, + "post": True + } + + methods = ["GET", "POST"] + + tags = ["poll"] + + async def get(self, data: ApiData) -> JSON: + """Get a specific poll.""" + PollT = self.alchemy.get(Poll) + + try: + pid = uuid.UUID(data["uuid"]) + except (ValueError, AttributeError, TypeError): + raise InvalidParameterError("'uuid' is not a valid UUID.") + + poll: Poll = await asyncify(data.session.query(PollT).get, pid) + if poll is None: + raise NotFoundError("No such page.") + + return poll.json() + + async def post(self, data: ApiData) -> JSON: + """Create a new poll.""" + PollT = self.alchemy.get(Poll) + + poll = PollT( + id=uuid.uuid4(), + creator=await data.user(), + created=datetime.datetime.now(), + expires=datetime.datetime.fromisoformat(data["expires"]) if "expires" in data else None, + question=data["question"], + description=data.get("description"), + ) + + data.session.add(poll) + await data.session_commit() + + return poll.json() diff --git a/royalpack/stars/api_polls_list.py b/royalpack/stars/api_poll_list.py similarity index 71% rename from royalpack/stars/api_polls_list.py rename to royalpack/stars/api_poll_list.py index 3b007362..e478f6e5 100644 --- a/royalpack/stars/api_polls_list.py +++ b/royalpack/stars/api_poll_list.py @@ -5,16 +5,13 @@ from ..tables import Poll import uuid -class ApiPollsList(ApiStar): - path = "/api/polls/list/v1" +class ApiPollsListStar(ApiStar): + path = "/api/poll/list/v2" - summary = "Get a list of all polls." + tags = ["poll"] - requires_auth = True - - tags = ["polls"] - - async def api(self, data: ApiData) -> JSON: + async def get(self, data: ApiData) -> JSON: + """Get a list of all polls.""" PollT = self.alchemy.get(Poll) polls: List[Poll] = await asyncify(data.session.query(PollT).all) diff --git a/royalpack/stars/api_polls_create.py b/royalpack/stars/api_polls_create.py deleted file mode 100644 index 50105ee0..00000000 --- a/royalpack/stars/api_polls_create.py +++ /dev/null @@ -1,41 +0,0 @@ -from typing import * -import datetime -import uuid -from royalnet.utils import * -from royalnet.constellation.api import * -from ..tables import Poll - - -class ApiPollsCreate(ApiStar): - path = "/api/polls/create/v1" - - summary = "Create a new poll." - - parameters = { - "question": "The question to ask in the poll.", - "description": "A longer Markdown-formatted description.", - "expires": "A ISO timestamp of the expiration date for the poll.", - } - - requires_auth = True - - methods = ["POST"] - - tags = ["polls"] - - async def api(self, data: ApiData) -> JSON: - PollT = self.alchemy.get(Poll) - - poll = PollT( - id=uuid.uuid4(), - creator=await data.user(), - created=datetime.datetime.now(), - expires=datetime.datetime.fromisoformat(data["expires"]) if "expires" in data else None, - question=data["question"], - description=data.get("description"), - ) - - data.session.add(poll) - await data.session_commit() - - return poll.json() diff --git a/royalpack/stars/api_polls_get.py b/royalpack/stars/api_polls_get.py deleted file mode 100644 index 4208dfa7..00000000 --- a/royalpack/stars/api_polls_get.py +++ /dev/null @@ -1,34 +0,0 @@ -from typing import * -import datetime -from royalnet.utils import * -from royalnet.constellation.api import * -from ..tables import Poll -import uuid - - -class ApiPollsGet(ApiStar): - path = "/api/polls/get/v1" - - summary = "Get the poll with a specific id." - - parameters = { - "uuid": "The UUID of the poll to get.", - } - - requires_auth = True - - tags = ["polls"] - - async def api(self, data: ApiData) -> JSON: - PollT = self.alchemy.get(Poll) - - try: - pid = uuid.UUID(data["uuid"]) - except (ValueError, AttributeError, TypeError): - raise InvalidParameterError("'uuid' is not a valid UUID.") - - poll: Poll = await asyncify(data.session.query(PollT).get, pid) - if poll is None: - raise NotFoundError("No such page.") - - return poll.json() diff --git a/royalpack/stars/api_user_get_ryg.py b/royalpack/stars/api_user_get_ryg.py deleted file mode 100644 index 31d22350..00000000 --- a/royalpack/stars/api_user_get_ryg.py +++ /dev/null @@ -1,42 +0,0 @@ -import royalnet.constellation.api as rca -import royalnet.utils as ru -import royalnet.backpack.tables as rbt - - -class ApiUserGetRygStar(rca.ApiStar): - summary = "Ottieni le informazioni su un utente della Royal Games." - - description = "" - - methods = ["GET"] - - path = "/api/user/get/ryg/v1" - - requires_auth = False - - parameters = {"id": "L'id dell'utente di cui vuoi vedere le informazioni."} - - tags = ["user"] - - async def get_user(self, data: rca.ApiData): - user_id_str = data["id"] - try: - user_id = int(user_id_str) - except (ValueError, TypeError): - raise rca.InvalidParameterError("'id' is not a valid int.") - user: rbt.User = await ru.asyncify(data.session.query(self.alchemy.get(rbt.User)).get, user_id) - if user is None: - raise rca.NotFoundError("No such user.") - return user - - async def api(self, data: rca.ApiData) -> dict: - user = await self.get_user(data) - result = { - **user.json(), - "bio": user.bio.json() if user.bio is not None else None, - "fiorygi": user.fiorygi.fiorygi if user.fiorygi is not None else None, - "steam": [steam.json() for steam in user.steam], - "leagueoflegends": [leagueoflegends.json() for leagueoflegends in user.leagueoflegends], - "trivia": user.trivia_score.json() if user.trivia_score is not None else None - } - return result diff --git a/royalpack/stars/api_user_find_ryg.py b/royalpack/stars/api_user_ryg.py similarity index 52% rename from royalpack/stars/api_user_find_ryg.py rename to royalpack/stars/api_user_ryg.py index 60d3fe68..39198429 100644 --- a/royalpack/stars/api_user_find_ryg.py +++ b/royalpack/stars/api_user_ryg.py @@ -1,31 +1,40 @@ import royalnet.constellation.api as rca import royalnet.utils as ru import royalnet.backpack.tables as rbt -from .api_user_get_ryg import ApiUserGetRygStar -class ApiUserFindRygStar(ApiUserGetRygStar): - summary = "Ottieni le informazioni su un utente della Royal Games." - - description = "" - +class ApiUserRygStar(rca.ApiStar): methods = ["GET"] - path = "/api/user/find/ryg/v1" + path = "/api/user/ryg/v2" - requires_auth = False - - parameters = {"alias": "L'alias dell'utente di cui vuoi vedere le informazioni."} + parameters = { + "get": { + "uid": "(Choose one) The id of the user to get information about.", + "alias": "(Choose one) The alias of the user to get information about.", + } + } tags = ["user"] async def get_user(self, data: rca.ApiData): - user = await rbt.User.find(self.alchemy, data.session, data["alias"]) + uid = data.int("uid", optional=True) + alias = data.str("alias", optional=True) + + if uid: + user = await rbt.User.find(self.alchemy, data.session, uid) + elif alias: + user = await rbt.User.find(self.alchemy, data.session, alias) + else: + raise rca.MissingParameterError("Neither uid or alias were specified.") + if user is None: raise rca.NotFoundError("No such user.") + return user - async def api(self, data: rca.ApiData) -> dict: + async def get(self, data: rca.ApiData) -> dict: + """Get Royalpack information about a user.""" user = await self.get_user(data) result = { **user.json(), diff --git a/royalpack/stars/api_wiki_edit.py b/royalpack/stars/api_wiki_edit.py deleted file mode 100644 index 2c0f6d43..00000000 --- a/royalpack/stars/api_wiki_edit.py +++ /dev/null @@ -1,64 +0,0 @@ -import uuid -import royalnet.utils as ru -from royalnet.backpack.tables import * -from royalnet.constellation.api import * -from ..tables import WikiPage - - -class ApiWikiEditStar(ApiStar): - path = "/api/wiki/edit/v1" - - methods = ["POST"] - - summary = "Edit the contents of a wiki page, or create a new one." - - parameters = { - "id": "The id of the wiki page to edit. Leave empty to create a new one.", - "title": "The new title of the wiki page.", - "contents": "The new contents of the wiki page.", - "format": "The format of the wiki page. The default is markdown.", - "theme": "The theme of the wiki page. The default is default." - } - - requires_auth = True - - tags = ["wiki"] - - async def api(self, data: ApiData) -> ru.JSON: - page_id = data.get("id") - title = data["title"] - contents = data["contents"] - format = data["format"] - theme = data["theme"] - - WikiPageT = self.alchemy.get(WikiPage) - - user = await data.user() - if not ("admin" in user.roles or "member" in user.roles or "bot" in user.roles): - raise ForbiddenError("You do not have sufficient permissions to edit this page.") - - if page_id is None: - page = WikiPageT( - page_id=uuid.uuid4(), - title=title, - contents=contents, - format=format, - theme=theme - ) - data.session.add(page) - else: - page = await ru.asyncify( - data.session - .query(WikiPageT) - .filter_by(page_id=uuid.UUID(page_id)) - .one_or_none - ) - if page is None: - raise NotFoundError(f"No page with the id {repr(page_id)} found.") - page.title = title - page.contents = contents - page.format = format - page.theme = theme - - await data.session_commit() - return page.json_full() diff --git a/royalpack/stars/api_wiki_get.py b/royalpack/stars/api_wiki_get.py deleted file mode 100644 index 3f0c843a..00000000 --- a/royalpack/stars/api_wiki_get.py +++ /dev/null @@ -1,30 +0,0 @@ -from starlette.requests import Request -from starlette.responses import * -from royalnet.constellation import * -from royalnet.utils import * -from ..tables import * -import uuid -from royalnet.constellation.api import * - - -class ApiWikiGetStar(ApiStar): - path = "/api/wiki/get/v1" - - summary = "Get information about a specific wiki page." - - parameters = { - "id": "The id of the wiki page to get information for." - } - - tags = ["wiki"] - - async def api(self, data: ApiData) -> dict: - wikipage_id_str = data["id"] - try: - wikipage_id = uuid.UUID(wikipage_id_str) - except (ValueError, AttributeError, TypeError): - raise InvalidParameterError("'id' is not a valid UUID.") - wikipage: WikiPage = await asyncify(data.session.query(self.alchemy.get(WikiPage)).get, wikipage_id) - if wikipage is None: - raise NotFoundError("No such page.") - return wikipage.json_full() diff --git a/royalpack/stars/api_wiki_list.py b/royalpack/stars/api_wiki_list.py deleted file mode 100644 index 6592fdd6..00000000 --- a/royalpack/stars/api_wiki_list.py +++ /dev/null @@ -1,19 +0,0 @@ -from starlette.requests import Request -from starlette.responses import * -from royalnet.constellation import * -from royalnet.utils import * -from royalnet.backpack.tables import * -from ..tables import * -from royalnet.constellation.api import * - - -class ApiWikiListStar(ApiStar): - path = "/api/wiki/list/v1" - - summary = "Get a list of available wiki pages." - - tags = ["wiki"] - - async def api(self, data: ApiData) -> JSON: - pages: typing.List[WikiPage] = await asyncify(data.session.query(self.alchemy.get(WikiPage)).all) - return [page.json_list() for page in sorted(pages, key=lambda p: p.title)] diff --git a/royalpack/utils/__init__.py b/royalpack/utils/__init__.py index 619a095d..bf359037 100644 --- a/royalpack/utils/__init__.py +++ b/royalpack/utils/__init__.py @@ -1,9 +1,7 @@ from .royalqueue import RoyalQueue -from .finduser import find_user_api from .royalpool import RoyalPool __all__ = [ "RoyalQueue", - "find_user_api", "RoyalPool", ] diff --git a/royalpack/utils/finduser.py b/royalpack/utils/finduser.py deleted file mode 100644 index d13ea95b..00000000 --- a/royalpack/utils/finduser.py +++ /dev/null @@ -1,19 +0,0 @@ -from typing import * -from royalnet.constellation.api import * -from royalnet.backpack.tables.users import User -from royalnet.utils import asyncify - -async def find_user_api(input: Union[int, str], alchemy, session): - if isinstance(input, int): - user_id = input - elif isinstance(input, str): - try: - user_id = int(input) - except ValueError: - raise InvalidParameterError(f"Invalid user id passed to {find_user_api.__name__}") - else: - raise TypeError(f"Invalid input type passed to {find_user_api.__name__}") - user: User = await asyncify(session.query(alchemy.get(User)).get, user_id) - if user is None: - raise NotFoundError("No such user.") - return user