Skip to main content

API Wrapper

https://api.travis-ci.org/ardydedase/apiwrapper.svg https://img.shields.io/pypi/v/apiwrapper.svg Documentation Status

Simple API Wrapper

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.

History

0.1.0 (2015-01-11)

  • First release on PyPI.

Release files for apiwrapper 0.1.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for apiwrapper 0.1.8
File Size Uploaded
apiwrapper-0.1.8.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for apiwrapper 0.1.8
File Interpreter ABI Platform
apiwrapper-0.1.8-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 25.2 kB

Release files / apiwrapper-0.1.8.tar.gz

Download URL apiwrapper-0.1.8.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
3f71080ce6b048d6df54930894d82472bb7a4a4c86b1f22a3f3e3335f147be61
BLAKE2b-256 checksum
How to use checksums
12669ed4b8fedaf84b7eb746c88ac698cf888bbb2785e4e845fd8cded3554bf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / apiwrapper-0.1.8-py2.py3-none-any.whl

Download URL apiwrapper-0.1.8-py2.py3-none-any.whl
Size 7.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
639adcbacc7cc561af7c4c68a9068a34d11de969d0ed8d7548efeccaf085208a
BLAKE2b-256 checksum
How to use checksums
bf2555bbbdd534d96f66fe038121bbe7d77db846a1fe37229d383438e19fdee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.8 This release

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

1 release file

0.1.3

2 release files

0.1.2

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page