Skip to main content

image image image image build image CodeQL image ty

Clients originally provided requests wrappers to encourage best practices, particularly always using Sessions to connect to the same host or api endpoint. The primary goals were:

  • provide a Client object with a convenient constructor
  • support a base url so that requests can provide a relative path
  • provide the same interface for asyncio

Since then httpx(2) has emerged as the successor to requests, and supports the above features natively. So clients.Client can be replaced with httpx.Client for most use cases. The project will continue to be maintained for additional features, such as the Resource object.

Usage

Typical requests usage is redundant and inefficient, by not taking advantage of connection pooling.

r = requests.get('https://api.github.com/user', headers={'authorization': token})
r = requests.get('https://api.github.com/user/repos', headers={'authorization': token})

Using sessions is the better approach, but more verbose and in practice requires manual url joining.

s = requests.Session()
s.headers['authorization'] = token
r = s.get('https://api.github.com/user')
r = s.get('https://api.github.com/user/repos')

Client

Clients make using sessions easier, with implicit url joining.

client = clients.Client('https://api.github.com/', headers={'authorization': token})
r = client.get('user')
r = client.get('user/repos')

Resource

Resources extend Clients to implicitly handle response content, with proper checking of status_code and content-type.

github = clients.Resource('https://api.github.com/', headers={'authorization': token})
for repo in github.get('user/repos', params={'visibility': 'public'}):
    ...

Resources also implement syntactic support for methods such as getattr and call, providing most of the benefits of custom clients as is.

for repo in github.user.repos(visibility='public'):
    ...

Asynchronous variants of all client types are provided, e.g., AsyncClient. Additional clients for RPC, GraphQL, and proxies also provided.

Installation

pip install clients

Dependencies

  • httpx2

Tests

100% branch coverage.

pytest [--cov]

Release files for clients 1.6

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

Source distribution (sdist)

Source distribution for clients 1.6
File Size Uploaded
clients-1.6.tar.gz 9.7 kB Details

Built distribution (wheel)

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

Total release size: 18.5 kB

Release files / clients-1.6.tar.gz

Download URL clients-1.6.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
cd0302f5d52fe516dbfc45bd4fecb8c72e8e232cd17b32d5154ccbec5645cd43
BLAKE2b-256 checksum
How to use checksums
7b55edad1b03b9b0632d7d00ba128ff51a33c5f324e199163d92e37c51db7751
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release files / clients-1.6-py3-none-any.whl

Download URL clients-1.6-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01ec230cd0970e95d0503c7d01ddb9f14de1694af46ff583c6e942bca9bd95d1
BLAKE2b-256 checksum
How to use checksums
9f0105752ebb01a5f831f86f23cab18d021c40cecde5daea6a27e0a165185b62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.6 This release

2 release files

1.5.1

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

0.5

2 release files

0.4

2 release files

0.3

2 release files

0.2

1 release file

0.1

1 release file

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