Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

HTTP for lazy, impatient, hubristic humans.

Project description

Clients provide requests and aiohttp wrappers which encourage best practices, particularly always using Sessions to connect to the same host or api endpoint.


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

r = requests.get('', headers={'authorization': token})
r = requests.get('', 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('')
r = s.get('')

Clients make using sessions easier, with implicit url joining.

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

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

github = clients.Resource('', 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, without having to define a schema.

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

Being session based, Clients work seamlessly with other requests adapters, such as CacheControl. Asynchronous variants of all client types are provided in Python >=3.5, using aiohttp instead of requests. Additional clients for RPC, GraphQL, and proxies also provided.

Read the documentation.


$ pip install clients


  • requests >=2.4.2
  • aiohttp (if Python >=3.5)


100% branch coverage.

$ pytest [--cov]



  • AsyncClient default params
  • Remote and AsyncRemote procedure calls
  • Graph and AsyncGraph execute GraphQL queries
  • Proxy and AsyncProxy clients


  • Asynchronous clients and resources


  • singleton decorator


  • Resource attribute upcasts back to a client
  • iter and download implement GET requests with streamed content
  • create implements POST request and returns Location header
  • update implements PATCH request with json params
  • __call__ implements GET request with params

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
clients-0.5-py2.py3-none-any.whl (10.3 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Dec 19, 2017
clients-0.5.tar.gz (18.1 kB) Copy SHA256 hash SHA256 Source None Dec 19, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page