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)
    return 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.0.tar.gz (6.8 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.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: realerikrani_baseclient-1.0.0.tar.gz
  • Upload date:
  • Size: 6.8 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.0.tar.gz
Algorithm Hash digest
SHA256 8358aac59f509b38221a2145d2f8a2eb586ada2de0e178727ecbc9713db3b71a
MD5 88d7940624e54718a7591cf814429974
BLAKE2b-256 b6e4a0b9f548655becff1e4a07fc9a3ef96ace4bd5bf23f873b74292abc034b0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for realerikrani_baseclient-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e5ccbd721ba69d1e1a4dbdc3c26355d4b6c4ea88b8a4156ac0fadb7d3fab1496
MD5 a3995309b8adf6a9a327f71881325869
BLAKE2b-256 79b29300543147fdbe54582b4f92fe4c3ecc3c1830be306dcb628987f40a124e

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