From 82964a039fa92deec7993ce40beee632462fd520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Attila=20Sz=C3=A1sz?= Date: Thu, 20 Apr 2017 01:31:01 +0100 Subject: [PATCH] HTTP request shall declare x-www-form-urlencoded header. --- instagram/oauth2.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/instagram/oauth2.py b/instagram/oauth2.py index 053b1be8..77847b3d 100644 --- a/instagram/oauth2.py +++ b/instagram/oauth2.py @@ -109,7 +109,8 @@ def exchange_for_access_token(self, code=None, username=None, password=None, sco data = self._data_for_exchange(code, username, password, scope=scope, user_id=user_id) http_object = Http(disable_ssl_certificate_validation=True) url = self.api.access_token_url - response, content = http_object.request(url, method="POST", body=data) + response, content = http_object.request( + url, method="POST", body=data, headers = {"Content-type": "application/x-www-form-urlencoded"}) parsed_content = simplejson.loads(content.decode()) if int(response['status']) != 200: raise OAuth2AuthExchangeError(parsed_content.get("error_message", ""))