mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add support for custom base_url in GithubIntegration class (#1093)
* Add support for custom base_url in GithubIntegration * Fix non default argument issue
This commit is contained in:
+5
-2
@@ -701,13 +701,16 @@ class GithubIntegration(object):
|
||||
Main class to obtain tokens for a GitHub integration.
|
||||
"""
|
||||
|
||||
def __init__(self, integration_id, private_key):
|
||||
def __init__(self, integration_id, private_key, base_url=DEFAULT_BASE_URL):
|
||||
"""
|
||||
:param base_url: string
|
||||
:param integration_id: int
|
||||
:param private_key: string
|
||||
"""
|
||||
self.base_url = base_url
|
||||
self.integration_id = integration_id
|
||||
self.private_key = private_key
|
||||
assert isinstance(base_url, (str, unicode)), base_url
|
||||
|
||||
def create_jwt(self, expiration=60):
|
||||
"""
|
||||
@@ -746,7 +749,7 @@ class GithubIntegration(object):
|
||||
if user_id:
|
||||
body = {"user_id": user_id}
|
||||
response = requests.post(
|
||||
"https://api.github.com/app/installations/{}/access_tokens".format(installation_id),
|
||||
"{}/app/installations/{}/access_tokens".format(self.base_url, installation_id),
|
||||
headers={
|
||||
"Authorization": "Bearer {}".format(self.create_jwt()),
|
||||
"Accept": Consts.mediaTypeIntegrationPreview,
|
||||
|
||||
Reference in New Issue
Block a user