Skip to main content

No project description provided

Project description

api-lib Format and tests cov

A lightweight Python library for building and consuming APIs with ease.

Features

  • Simple API client utilities
  • Built-in request/response handling
  • Extensible and easy to integrate

Installation

It's recommended to use uv to install the package:

uv add api-lib

Usage

Example: Consuming an API

from api_lib import ApiLib
from api_lib.headers.accept import AcceptGithub
from api_lib.headers.authorization import Bearer
from api_lib.method import Method

from .response import Repository, User

class GithubAPI(ApiLib):
    headers = [AcceptGithub()]

    async def user(self) -> User:
        return await self.req(Method.GET, "/user", User)


api = GithubAPI("https://api.github.com", Bearer(env_var="GITHUB_TOKEN"))

user = await gh_api.user()

Documentation

See the full documentation for more details and advanced usage.

Contributing

Contributions are welcome! Please open issues or submit pull requests.

License

This project is licensed under the MIT License.

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

api_lib-0.0.2.tar.gz (50.0 kB view details)

Uploaded Source

Built Distribution

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

api_lib-0.0.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file api_lib-0.0.2.tar.gz.

File metadata

  • Download URL: api_lib-0.0.2.tar.gz
  • Upload date:
  • Size: 50.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for api_lib-0.0.2.tar.gz
Algorithm Hash digest
SHA256 199f6ef75a81a13e4994aa8dd9b73e73273993bcd5cc78713a47c87b97fd80f0
MD5 fdc307be6864fb91f5c8b9017b4bb08f
BLAKE2b-256 bf38593b580e50dacce914e6a3d6d7dc68936486d6fdbe0fe7746204891e12e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for api_lib-0.0.2.tar.gz:

Publisher: publish.yaml on jeandemeusy/api-lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file api_lib-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: api_lib-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for api_lib-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3613fd2700c6025d35e0ffcdabfc123154b401e49df71fa6c9018881da2536d1
MD5 a8c49ea9cec1658aefde6f3d965a11c2
BLAKE2b-256 1074038e92f54664e4ef24ab128ee1a2f27ed48cd757b370666f79d6555e8d0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for api_lib-0.0.2-py3-none-any.whl:

Publisher: publish.yaml on jeandemeusy/api-lib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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