This is a simple API client for Github, written in Python.
The client implements v3 of the API.
The Github API Client works only with token authentication.
To use methods, requiring authentication, provide a token as environment variable GITHUB_TOKEN
The Github API Client defines model classes for each data type, which cover the response json.
The model classes don't allow you to assign attributes, not defined in the model, so they try to protect you from typos.
The attributes follow 1:1 the json attribute names, provided by GitHub.
from github_api_client import users
users.get_user(login)
The method do not require authentication.
It raises exception on anything but 200 OK.
It returns users.User instance, which includes the following attributes:
- login
- id
- node_id
- avatar_url
- gravatar_id
- url
- html_url
- followers_url
- following_url
- gists_url
- starred_url
- subscriptions_url
- organizations_url
- repos_url
- events_url
- received_events_url
- type
- site_admin
- name
- company
- blog
- location
- hireable
- bio
- twitter_username
- public_repos
- public_gists
- followers
- following
- created_at
- updated_at
users.get_authenticated_user()
The method requires authentication.
It raises exception on anything but 200 OK.
It returns users.AuthenticatedUser instance, which include all User fields + the following additional attributes:
- private_gists
- total_private_repos
- owned_private_repos
- disk_usage
- collaborators
- two_factor_authentication
- plan
- Implement rate limits
- Wrap HTTPError in GitHubClientError
- Make it a real Python Package with .toml, etc.
If you want to patch something, play around, run the tests, just follow the instructions below.
You need to have Docker CE and Docker Compose installed.
If your environment is other than GNU/Linux, there may be some differences in the interaction with Docker, so please follow the Docker documentation if something doesn't suits you.
Under environment/
you'll find all the configuration files, you need to run the
project on docker.
To prepare your environment, you need to cd ./environment
and:
- Sync the
.env.tmpl
file to.env
. For now, you may, but you don't really need to change anything in the .env file. - run
$ docker-compose up --build
That's all!
To run all the linters and tests, you need to:
$ cd environment
$ docker-compose exec app bash -c "./run_checks.py --help"
To keep things clean, we use: