fix request got an unexpected keyword argument body (#1012)

Resolves #1010
This commit is contained in:
秋葉
2019-01-18 15:37:08 +08:00
committed by Wan Liuyang
parent 5f5c276465
commit ff789dcc81
+11 -9
View File
@@ -772,16 +772,18 @@ class GithubIntegration(object):
:param installation_id: int
:return: :class:`github.InstallationAuthorization.InstallationAuthorization`
"""
body = None
body = {}
if user_id:
body = json.dumps({"user_id": user_id})
response = requests.post("https://api.github.com/installations/{}/access_tokens".format(installation_id),
headers={
"Authorization": "Bearer {}".format(self.create_jwt()),
"Accept": Consts.mediaTypeIntegrationPreview,
"User-Agent": "PyGithub/Python"
},
body=body)
body = {"user_id": user_id}
response = requests.post(
"https://api.github.com/installations/{}/access_tokens".format(installation_id),
headers={
"Authorization": "Bearer {}".format(self.create_jwt()),
"Accept": Consts.mediaTypeIntegrationPreview,
"User-Agent": "PyGithub/Python"
},
json=body
)
response_text = response.text
if atLeastPython3: