Skip to main content

Foundation for building API clients. A wrapper around requests.

Project description

baseclient

Foundation for building API clients. A wrapper around requests which is licensed under the Apache License 2.0. See the LICENSE file for more details. The original NOTICE file is included in this project and extended with this project's notice.

import requests
from realerikrani.baseclient import BaseAdapter, BaseClient


adapter = BaseAdapter()
with requests.Session() as session:
    baseclient = BaseClient(session=session, adapter=adapter, url=YOUR_BASE_URL)
    YourCustomClient(baseclient)
@dataclass
class YourCustomClient:
    http_client: BaseClient

    def create(self: Self, name: str) -> YourModel:
        url = f"{self.http_client.url}/things"

        response = self.http_client.post(
            url, data={"name": name}, auth=None
        ).json()
        return YourModel.make(response["thing"])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

realerikrani_baseclient-1.0.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

realerikrani_baseclient-1.0.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file realerikrani_baseclient-1.0.1.tar.gz.

File metadata

  • Download URL: realerikrani_baseclient-1.0.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.2

File hashes

Hashes for realerikrani_baseclient-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fc9ebd2ee158fe8f4bdca00157e4840c7b7e5b78d25a2eeb7a3278089381463a
MD5 3b44c0209ac3f715af2de519240248eb
BLAKE2b-256 83f2d1aded71a62faf98fcce6a966661aca3c2b718265919130ca582b30fdfaf

See more details on using hashes here.

File details

Details for the file realerikrani_baseclient-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for realerikrani_baseclient-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75ecca2ca537dbdffcffeab575fdbca2ff068cb9faa9472c5e20cfd228870833
MD5 055ae2be17248fcb6ed3d21229865099
BLAKE2b-256 432e64d160cd5f5225c3210ac45ff2e711984c293495a072d7e81ea11cb88c04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page