From ff789dcc819ecaf79ab208f5c9c168b58ea349e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E8=91=89?= Date: Fri, 18 Jan 2019 15:37:08 +0800 Subject: [PATCH] fix request got an unexpected keyword argument body (#1012) Resolves #1010 --- github/MainClass.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/github/MainClass.py b/github/MainClass.py index c199c829..f12d092a 100644 --- a/github/MainClass.py +++ b/github/MainClass.py @@ -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: