Python github api client

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Python client for GitHub API

License

khornberg/octokit.py

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Читайте также:  Php проверить является ли классом

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.rst

Python client for GitHub API

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

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
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

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

octokit = Octokit(auth='basic', username='myuser', password='mypassword')
response = Octokit(auth='token', token='yak').authorization.get(id=100)
octokit = Octokit(auth='app', app_id='42', private_key=private_key)
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.

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

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

[-] REST (see best practices, integration tests, and errors) [ ] GraphQL client [x] GitHub Apps [ ] OAuth Apps [x] Webhooks
[x] unit tests [ ] integration tests - need fixtures to assert against [x] coverage uploaded to code climate
[ ] Raise `OctokitValidationError` for param validation error [ ] Raise `OctokitAuthenticationError` for auth error [ ] Raise `OctokitRateLimitError` for rate limiting errors
[ ] throttling [ ] handles rate limiting [x] pagination
[ ] Auto generated documentation
[x] Deploy wheels [ ] GitHub releases

Check box guide

[ ] Incomplete [-] Partially completed [x] Completed

Pull requests are very welcome!

Please see CONTRIBUTING.md for more information.

Источник

Introduction¶

PyGithub is a Python library to use the Github API v3. With it, you can manage your Github resources (repositories, user profiles, organizations, etc.) from Python scripts.

Should you have any question, any remark, or if you find a bug, or if there is something you can do with the API but not with PyGithub, please open an issue.

(Very short) tutorial¶

First create a Github instance:

from github import Github # Authentication is defined via github.Auth from github import Auth # using an access token auth = Auth.Token("access_token") # Public Web Github g = Github(auth=auth) # Github Enterprise with custom hostname g = Github(auth=auth, base_url="https:// /api/v3") 

Then play with your Github objects:

for repo in g.get_user().get_repos(): print(repo.name) repo.edit(has_wiki=False) # to see all the available attributes and methods print(dir(repo)) 

Download and install¶

This package is in the Python Package Index, so pip install PyGithub should be enough. You can also clone it on Github.

Licensing¶

PyGithub is distributed under the GNU Lesser General Public Licence. See files COPYING and COPYING.LESSER, as requested by GNU.

What next?¶

You need to use a Github API and wonder which class implements it? Reference of APIs.

You want all the details about PyGithub classes? Reference of Classes.

Projects using PyGithub¶

(Open an issue if you want to be listed here, I’ll be glad to add your project)

  • Github-iCalendar returns all of your Github issues and pull requests as a list of tasks / VTODO items in iCalendar format.
  • DevAssistant
  • Upverter is a web-based schematic capture and PCB layout tool for people who design electronics. Designers can attach a Github project to an Upverter project.
  • Notifico receives messages (such as commits and issues) from services and scripts and delivers them to IRC channels. It can import/sync from Github.
  • Tratihubis converts Trac tickets to Github issues
  • https://github.com/fga-gpp-mds/2018.1-Cardinals — website that shows metrics for any public repository (issues, commits, pull requests etc)
  • https://github.com/CMB/cligh
  • https://github.com/natduca/quickopen uses PyGithub to automatically create issues
  • https://gist.github.com/3433798
  • https://github.com/zsiciarz/aquila-dsp.org
  • https://github.com/robcowie/virtualenvwrapper.github
  • https://github.com/kokosing/git-gifi — Git and github enhancements to git.
  • https://github.com/csurfer/gitsuggest — A tool to suggest github repositories based on the repositories you have shown interest in
  • https://github.com/gomesfernanda/some-github-metrics — Python functions for relevant metrics on GitHub repositories
  • https://github.com/SOM-Research/Gitana — a SQL-based Project Activity Inspector
  • https://github.com/plus3it/satsuki — Automate GitHub releases and uploading binary release assets
  • check-in — Python CLI distribution that allows user to use GitHub Checks API as a bot.
  • https://github.com/hasii2011/gittodoistclone — Convert GitHub issues to Todoist tasks

They talk about PyGithub¶

© Copyright 2023, Vincent Jacques Revision 48d2009c .

Versions latest stable Downloads On Read the Docs Project Home Builds Free document hosting provided by Read the Docs.

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Typed interactions with the GitHub API v3

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

PyGithub/PyGithub

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Sign In Required

Please sign in to use Codespaces.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching GitHub Desktop

If nothing happens, download GitHub Desktop and try again.

Launching Xcode

If nothing happens, download Xcode and try again.

Launching Visual Studio Code

Your codespace will open once ready.

There was a problem preparing your codespace, please try again.

Latest commit

Git stats

Files

Failed to load latest commit information.

README.md

PyGitHub is a Python library to access the GitHub REST API. This library enables you to manage GitHub resources such as repositories, user profiles, and organizations in your Python applications.

from github import Github # Authentication is defined via github.Auth from github import Auth # using an access token auth = Auth.Token("access_token") # First create a Github instance: # Public Web Github g = Github(auth=auth) # Github Enterprise with custom hostname g = Github(base_url="https:///api/v3", auth=auth) # Then play with your Github objects: for repo in g.get_user().get_repos(): print(repo.name)

More information can be found on the PyGitHub documentation site.

Long-term discussion and bug reports are maintained via GitHub Issues. Code review is done via GitHub Pull Requests.

For more information read CONTRIBUTING.md.

We’re actively seeking maintainers that will triage issues and pull requests and cut releases. If you work on a project that leverages PyGitHub and have a vested interest in keeping the code alive and well, send an email to someone in the MAINTAINERS file.

About

Typed interactions with the GitHub API v3

Источник

Оцените статью