Simple API Wrapper
Project description
Simple API Wrapper
Free software: BSD license
Documentation: https://apiwrapper.readthedocs.org.
Overview
Recently noticed a pattern and repeated pieces of code in Python API wrappers for simple requests and polling. A separate Python package will minimize code duplication and encourage de-coupling of logic from the API request functions.
Installation
At the command line:
$ easy_install apiwrapper
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv apiwrapper $ pip install apiwrapper
Getting started with a simple request
# as a helper class
from apiwrapper import APIWrapper
my_api = APIWrapper()
url = 'https://api.github.com/users/ardydedase/repos'
resp = my_api.make_request(url=url)
print(resp)
# as a parent class
class GithubAPI(APIWrapper):
def get_repos(self, username):
"""
Uses `make_request` method
"""
url = "https://api.github.com/users/{username}/repos".format(username=username)
return self.make_request(url, method='get', headers=None, data=None, callback=None)
More features including polling
Read the docs: https://apiwrapper.readthedocs.org/en/latest/usage.html
Or use apiwrapper/apiwrapper.py as a reference. Implementation is straightforward.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
apiwrapper-0.1.7.tar.gz
(17.1 kB
view hashes)
Built Distribution
Close
Hashes for apiwrapper-0.1.7-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efcea3c23d49eaef60277a5cade45d779a37b836eff02dca6a9804e684f1604b |
|
MD5 | cdf87852bfb280641ee97fe214a10980 |
|
BLAKE2b-256 | 99951e3d58f435e9da3ccbaafc2e944cfcb862883bc2ff5fb02cc98c271f3a84 |