Package: thothlibrary
Python client for Thoth's GraphQL and REST APIs. Currently supports Thoth version 0.6.0.UsageInstallInstall is either via pip or cloning the repository.From pip:python3-mpipinstallthothlibrary==0.24.0Or from the repo:gitclonegit@github.com:thoth-pub/thoth-client.gitcdthoth-client
pip3install-r./requirements.txtGraphQL UsagefromthothlibraryimportThothClientthoth=ThothClient()print(thoth.works())CLI GraphQL Usagepython3-mthothlibrary.clicontribution--contribution_id=29e4f46b-851a-4d7b-bb41-e6f305fc2b11
python3-mthothlibrary.clicontributions--limit=10python3-mthothlibrary.clicontribution_count
python3-mthothlibrary.clicontributor--contributor_id=e8def8cf-0dfe-4da9-b7fa-f77e7aec7524
python3-mthothlibrary.clicontributors--limit=10python3-mthothlibrary.clicontributor_count--search="Vincent"python3-mthothlibrary.cliinstitution--institution_id=194614ac-d189-4a74-8bf4-74c0c9de4a81
python3-mthothlibrary.cliinstitutions--limit=10python3-mthothlibrary.clifunding_count
python3-mthothlibrary.clifunding--funding_id=5323d3e7-3ae9-4778-8464-9400fbbb959e
python3-mthothlibrary.clifundings--limit=10python3-mthothlibrary.cliimprint--imprint_id=78b0a283-9be3-4fed-a811-a7d4b9df7b25
python3-mthothlibrary.cliimprints--limit=25--offset=0--publishers='["85fd969a-a16c-480b-b641-cb9adf979c3b" "9c41b13c-cecc-4f6a-a151-be4682915ef5"]'python3-mthothlibrary.cliimprint_count--publishers='["85fd969a-a16c-480b-b641-cb9adf979c3b" "9c41b13c-cecc-4f6a-a151-be4682915ef5"]'python3-mthothlibrary.cliissue--issue_id=6bd31b4c-35a9-4177-8074-dab4896a4a3d
python3-mthothlibrary.cliissues--limit=10python3-mthothlibrary.cliissue_count
python3-mthothlibrary.clilanguage--language_id=c19e68dd-c5a3-48f1-bd56-089ee732604c
python3-mthothlibrary.clilanguages--limit=10--language_codes=CHI
python3-mthothlibrary.clilanguage_count--language_codes=CHI
python3-mthothlibrary.cliprice--price_id=818567dd-7d3a-4963-8704-3381b5432877
python3-mthothlibrary.cliprices--limit=10--currency_codes=GBP
python3-mthothlibrary.cliprice_count--currency_codes=GBP
python3-mthothlibrary.clipublication--publication_id=27b7bdab-e9e5-4220-811e-1f370861f5e1
python3-mthothlibrary.clipublications--limit=10--publishers='["85fd969a-a16c-480b-b641-cb9adf979c3b"]'python3-mthothlibrary.clipublication_count--publication_types="HARDBACK"python3-mthothlibrary.clipublisher--publisher_id=85fd969a-a16c-480b-b641-cb9adf979c3b
python3-mthothlibrary.clipublishers--limit=10--order='{field: PUBLISHER_ID, direction: ASC}'--offset=0--publishers='["85fd969a-a16c-480b-b641-cb9adf979c3b" "9c41b13c-cecc-4f6a-a151-be4682915ef5"]'python3-mthothlibrary.clipublisher_count--publishers='["85fd969a-a16c-480b-b641-cb9adf979c3b" "9c41b13c-cecc-4f6a-a151-be4682915ef5"]'python3-mthothlibrary.cliseries--series_id=d4b47a76-abff-4047-a3c7-d44d85ccf009
python3-mthothlibrary.cliserieses--limit=3--search="Classics"python3-mthothlibrary.cliseries_count--series_types=BOOK_SERIES
python3-mthothlibrary.clisubject--subject_id=1291208f-fc43-47a4-a8e6-e132477ad57b
python3-mthothlibrary.clisubjects--limit=10--subject_types=BIC
python3-mthothlibrary.clisubject_count--subject_types=THEMA
python3-mthothlibrary.clisupported_versions
python3-mthothlibrary.cliupdate_cover--doi="https://doi.org/10.11647/OBP.0278"--url="https://cdn.openbookpublishers.com/covers/10.11647/obp.0278.jpg"python3-mthothlibrary.cliwork--doi="https://doi.org/10.11647/OBP.0222"python3-mthothlibrary.cliwork--work_id="e0f748b2-984f-45cc-8b9e-13989c31dda4"python3-mthothlibrary.cliworks--limit=10--order='{field: PUBLICATION_DATE, direction: DESC}'--work_status=ACTIVE--work_types=MONOGRAPH--offset=1--publishers='["85fd969a-a16c-480b-b641-cb9adf979c3b"]'python3-mthothlibrary.cliwork_count--publishers='["85fd969a-a16c-480b-b641-cb9adf979c3b"]'REST UsagefromthothlibraryimportThothRESTClientclient=ThothRESTClient()print(client.formats())CLI REST Usagepython3-mthothrest.cli
python3-mthothrest.cliformats
python3-mthothrest.cliformats--return-json
python3-mthothrest.cliworkonix_3.0::project_musee0f748b2-984f-45cc-8b9e-13989c31dda4Thoth DjangoThe thothdjango folder includes models, an import routine, subject-code support, and admin procedures to use Thoth in a django app. The import provides unidirectional synchronization from remote Thoth imports to a local database for use in a Django app.Test SuiteTests for GraphQL queries are versioned in the thoth-[ver] folder of thothlibrary.Tests confirm that current code produces good, known object outputs from stored GraphQL input.VersioningThe Thoth API is not yet considered stable and functionality changes between versions. The recommended way to add a new version compatibility is:Read the latest Thoth changelog to understand the changes.Copy the latest thoth-[ver] folder to the correctly named new version.Find and replace the strings specified in genfixtures.sh and genjson.sh. Update the version string in tests and endpoints.Run genjson.shonlyfrom inside the tests directory of the new version. This will fetch the latest server JSON responses and store it inside the fixtures directory for these tests. If there are any errors, then the command line CLI has encountered a breaking change that must first be fixed.Run the test suite for the latest version and examine breakages. It is possible that breakages are not actually full breakdown, but merely a change in the serialized object. Nonetheless, fix these by subclassing the previous versions of the API and overriding broken methods. In the cases of total breakage, a non-subclassed rewrite may be more appropriate. (May also apply at major version breaks.)When the test suite passes, or a new object format has been decided and tests rewritten, run genfixtures.sh to freeze the current test suite.Include the new version directory in the list of packages insetup.pyUpdateTHOTH_VERSIONinthothlibrary/client.py