Skip to main content

python-therapi

Therapy to ease the pain of writing boilerplate JSON API consumers.


Tired of writing the same code to consume JSON APIs, over and over? Let's solve that!

Query a basic, public JSON API

To query any basic, public JSON API, we create our consumer class and inherit from BaseAPIConsumer, as follows:

from therapi import BaseAPIConsumer

class MyAPIConsumer(BaseAPIConsumer):
    base_url = "https://www.an-awesome-service.com/api"

Now we can use this class to make API calls to different endpoints, as follows:

consumer = MyAPIConsumer()
result = consumer.json_request(method="get", path="items", params={"id": 123})
print(result)

We would see, for example, this response:

{
  "data": [
    {"name": "Laptop", "price": 239},
    {"name": "Printer", "price": 99}
  ]
}

Metadata

Release files for therapi 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for therapi 0.0.4
File Size Uploaded Provenance Actions
therapi-0.0.4.tar.gz 3.7 kB Without provenance Details for therapi-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for therapi 0.0.4
File Interpreter ABI Platform Actions
therapi-0.0.4-py3-none-any.whl Python 3 none any Details for therapi-0.0.4-py3-none-any.whl

Total release size: 8.0 kB

Release files / therapi-0.0.4.tar.gz

Download URL therapi-0.0.4.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cc8ad0587d47dd1a7fc242b06f18a9dc23abbc375f7a622d9a844539f2999095
BLAKE2b-256 checksum
How to use checksums
09c575b8f118101d64637f03596e6d398c043260ae87365143131e7541286a63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.1 Linux/6.2.6-76060206-generic

Release files / therapi-0.0.4-py3-none-any.whl

Download URL therapi-0.0.4-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfcc20766fd1d8a27d30d0c59651573795793162e852e0fa273bb131e151bbd1
BLAKE2b-256 checksum
How to use checksums
f5e282115d2ade5d97934ba9430b8176341da2893fc6293c90e4b23c6ebb747d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.1 Linux/6.2.6-76060206-generic

Security for therapi 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page