Skip to main content

An API Wrapper For Every API

Project description


AnyAPI is a library that I developed for myself to have better looking code instead putting URLs to everywhere I used dynamic method calls to access a endpoint.


  • Have better looking code using dynamic method calls
  • Filters to help you to modify request, raise errors or log requests instead of writing functions everywhere.
  • Automatically changing proxy according to rate limits specified by you for every path


Making GET request to

from anyapi import AnyAPI

base_url = ''
api = AnyAPI(base_url)


As you can see dots are pretended as slash and at the end you should put dot and HTTP method you want to use in capital letters.

Setting header before every request

import datetime
from anyapi import AnyAPI

def set_date_as_header(kwargs):
    now =
    kwargs['headers'].update({'date': now.strftime('%B %d %Y')})

    return kwargs

api = AnyAPI('')

# output
   'args': {},
   'data': '',
   'files': {},
   'form': {},
   'headers': {
      'Accept-Encoding': 'identity',
      'Connection': 'close',
      'Date': 'January 16 2019',
      'Host': ''
   'json': None,
   'method': 'GET',
   'origin': 'XX.XX.XX.XX',
   'url': ''

As you can see filter worked as expected and set Date header.

Changing proxy automatically after they reach their rate limit

from anyapi import AnyAPI
from anyapi.proxy_handlers import RateLimitProxy

proxy_configuration = {
  'default': proxy0,
  'proxies': [proxy0, proxy1, proxy2,....], # don't forget to add default proxy!
  'paths': {
    '/anything': rate_limit0,
    '/anything/endpoint': rate_limit1

api = AnyAPI('', proxy_configuration=proxy_configuration, proxy_handler=RateLimitProxy)

for i in range(10):

If you check output of the all them you can see proxy changes when it reaches limit.

This library is not a new thing

There is a lot of libraries you can find out there for example Uplink, Hammock and many more


Library is avaible on PyPi so just run

pip install anyapi

To learn more about AnyAPI check wiki page

Project details

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
anyapi-1.1.4-py3-none-any.whl (5.1 kB) Copy SHA256 hash SHA256 Wheel py3
anyapi-1.1.4.tar.gz (3.7 kB) Copy SHA256 hash SHA256 Source None

Supported by

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