Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

Agnostic Requests

Heavily inspired by agithub. Powered by Requests.

Usage

Let's make a GitHub API client.

from arequests import API

class Github(API):
    base_url = "https://api.github.com"

    def __init__(self, auth):
        super(Github, self).__init__()
        # self.session is a requests.Session [1] object here
        self.session.auth = auth
        self.session.headers.update({
            'Accept': 'application/vnd.github.v3+json'
        })

[1]: http://docs.python-requests.org/en/latest/user/advanced/#session-objects

>>> g = Github(("iamale", "f2a3ec8e7901edef12b6ce9bce437780b69a5cd3"))
>>> g.users["mdo"].get().json()
{
    'name': 'Mark Otto',
    'login': 'mdo',
    'blog': 'http://mdo.fm',
    'followers': 9388,
    'hireable': True,
    'site_admin': True,
    ...
}
>>> g.issues.get(params={"filter": "mentioned"}).json()
[{
    'id': 12345678,
    'repository': { ... },
    'number': 9,
    'state': 'open',
    'title': 'Propose a new schema',
    'body': ...,
    'comments': 6,
    ...
}, ...]

About

Agnostic API classes for Python Requests · mirrored from https://gitlab.com/notpushkin/arequests

Topics

Resources

License

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.