Skip to main content

А library for a REST API client that works with any API that follows somewhat the REST standard.

Project description

Build Status

Features

This library is a small REST API client with the following features:

  • Url builder - allows you to build a url by natively calling the client’s attributes

  • HTTP requests - a thin wrapper around the requests library that allows full control of the HTTP requests.

Installation

pip install universal-api-client

Usage

Initialising the client

from universal_api_client import Client
swapi_client = Client(base_url='https://swapi.co/api/')

Building a URL

The url builder is part of the request (APIRequest) attribute of the client.

swapi_client.request.people # <universal_api_client.request.APIRequest at 0x1093c3eb8>
swapi_client.request.people.url # 'https://swapi.co/api/people/'
swapi_client.request.people(identifier=1).url # 'https://swapi.co/api/people/1/'
swapi_client.request.people(identifier='1').url # 'https://swapi.co/api/people/1/'

Making a request

The requests are made by the already built APIRequest object. The method call returns the appropriate method call from the requests library.

response = swapi_client.request.people(identifier='1').get() # <Response [200]>
print(response.status_code) # 200

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

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

universal-api-client-0.1.0.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

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

universal_api_client-0.1.0-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file universal-api-client-0.1.0.tar.gz.

File metadata

  • Download URL: universal-api-client-0.1.0.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for universal-api-client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d62082b438011bf6b89647e6a3461dc94e2afef747368bfbc77d75542ce25b49
MD5 b4dce0c8ffd2e053a96757884bfc60e3
BLAKE2b-256 ca71edfc2fd1859d3c49c338013680f3213d52d11ca50154cb774c4ae2eed10b

See more details on using hashes here.

File details

Details for the file universal_api_client-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: universal_api_client-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for universal_api_client-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 87f873461877ea8ca3e9ffb1ba7dee0cba95aa390b8ae5f8f3b5fa930331e7cd
MD5 09e8b168f09e9a10eb1d2fd84ca233ce
BLAKE2b-256 841c32e98ca5148535653794550b0b1ad14ccbd4a6158680efa4bb909a90566c

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