Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub integrations support #449

Merged
merged 1 commit into from Jan 27, 2017
Merged

GitHub integrations support #449

merged 1 commit into from Jan 27, 2017

Conversation

jayfk
Copy link
Contributor

@jayfk jayfk commented Sep 15, 2016

This PR adds support for the all new GitHub Integrations.

Since the GithubIntegration is the main entrypoint to obtain access tokens, I've created it alongside the Github main class.

I wasn't able to recycle much of the functionality in Requester because the integration is too coupled with the Github main class. Instead, I've used the wonderful httplib.

Usage

from github import GithubIntegration, Github

# obtained during integration creation
private_key = "some private key"
integration_id = 123

# obtained when a user installs the integration (webhook)
installation_id = 456

# get a token
integration = GithubIntegration(integration_id, private_key)
auth = integration.get_access_token(installation_id)

gh = GitHub(auth.token)
repo = gh.get_repo("user/whatever")

Tests

None, yet. Integrations are in early access right now. I think it's safe to add tests once the API is stable.

Added dependencies

In order to create the JSON web token, this PR adds python-jose. Another candidate is pyjwt, but that isn't installable on Google Compute Engine.

@jayfk
Copy link
Contributor Author

jayfk commented Jan 27, 2017

This works, let's merge it in.

@jayfk jayfk merged commit 6f5a2d4 into master Jan 27, 2017
@jacquev6 jacquev6 deleted the integrations branch September 8, 2018 06:59
@webknjaz
Copy link
Contributor

webknjaz commented Jan 6, 2019

Hey @jayfk, in which case does InstallationAuthorization.on_behalf_of get populated with some value? I cannot find anything about it in docs...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants