Skip to main content

Boilerplate code for api integrations

Project description

AnyAPI

AnyAPI is a small library to get rid of boilerplate code reused in many projects where interaction with APIs is needed.

AnyAPI:

  • uses requests.Session
  • has default timeout
  • has configurable pool size
  • has retry policy in case of 429 error
  • has get and post methods defined

How to use

pip install anyapi2
from anyapi import API


class SomeServiceAPI(API):
    BASE_URL = 'https://some-api-service.com'


some_service = SomeServiceAPI()
response = some_service.get('/v1/items')
response.raise_for_status()
result = response.json()

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

anyapi2-0.0.6.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

anyapi2-0.0.6-py3-none-any.whl (4.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page