Giter VIP home page Giter VIP logo

octokit.py's Introduction

Overview

Python client for GitHub API

Installation

Note octokit and octokit.py were already taken in the cheese shop

pip install octokitpy

Documentation

https://octokitpy.readthedocs.io/en/latest/

Examples

REST API:

from octokit import Octokit
repos = Octokit().repos.list_for_user(username="octokit")
for repo in repos.json:
    print(repo["name"])
# Make an unauthenticated request for octokit's public repositories

Webhooks:

from octokit import webhook
webhook.verify(headers, payload, secret, events=['push'])

octokit.py provides a function to verify webhooks sent to your application.

headers
dictionary of request headers
payload
string; payload of request
secret
string; secret provided to GitHub to sign webhook
events
list; events that you want to receive
verify_user_agent
boolean; whether or not you want to verify the user agent string of the request
return_app_id
boolean; whether or not you want to return the app id from the ping event for GitHub applications. This will only return the id if the event is the ping event. Otherwise the return value will be boolean.

Note that webhook names are available at from octokit_routes import webhook_names

Authentication

Instantiate a client with the authentication scheme and credentials that you want to use.

basic:

octokit = Octokit(auth='basic', username='myuser', password='mypassword')

token:

response = Octokit(auth='token', token='yak').authorization.get(id=100)

app:

octokit = Octokit(auth='app', app_id='42', private_key=private_key)

app installation:

octokit = Octokit(auth='installation', app_id='42', private_key=private_key)

For applications, provide the application id either from the ping webhook or the application's page on GitHub. The private_key is a string of your private key provided for the application. The app scheme will use the application id and private key to get a token for the first installation id of the application.

API Schema/Routes/Specifications

One can instantiate the Octokit with routes=specification where the specification is one of api.github.com, ghe-2.15, etc.

Data

The octokit client based on the available route data and webhook data

TODOs

GitHub APIs

[-] REST (see best practices, integration tests, and errors)

[ ] GraphQL client

[x] GitHub Apps

[ ] OAuth Apps

[x] Webhooks

Tests

[x] unit tests

[ ] integration tests - need fixtures to assert against

[x] coverage uploaded to code climate

Errors

[ ] Raise `OctokitValidationError` for param validation error

[ ] Raise `OctokitAuthenticationError` for auth error

[ ] Raise `OctokitRateLimitError` for rate limiting errors

Best Practices

[ ] throttling

[ ] handles rate limiting

[x] pagination

Documentation

[ ] Auto generated documentation

Deployment

[x] Deploy wheels

[ ] GitHub releases

Check box guide

[ ] Incomplete

[-] Partially completed

[x] Completed

Development

To run the all tests run:

tox

Contributing

Pull requests are very welcome!

Please see CONTRIBUTING.md for more information.

Credits

Package based on cookiecutter-pylibrary

License

MIT

octokit.py's People

Contributors

khornberg avatar renovate-bot avatar pyup-bot avatar ehom avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.