Skip to content
This repository was archived by the owner on Sep 18, 2021. It is now read-only.

Commit c56f64c

Browse files
author
Tomoyuki Kakuda
authored
Merge pull request #3 from 4d11/master
Fix exchange_code_for_access_token.
2 parents 518ca9c + f6488e0 commit c56f64c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
.DS_Store
33
*.swp
44
test_settings.py
5-
5+
.idea
66
build

instagram/models.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ def __init__(self, id, *args, **kwargs):
205205
def __unicode__(self):
206206
return "User: %s" % self.username
207207

208+
def __eq__(self, other):
209+
return self.id == other.id
210+
211+
def __ne__(self, other):
212+
return not self == other
208213

209214
class Relationship(ApiModel):
210215

instagram/oauth2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ def exchange_for_access_token(self, code=None, username=None, password=None, sco
109109
data = self._data_for_exchange(code, username, password, scope=scope, user_id=user_id)
110110
http_object = Http(disable_ssl_certificate_validation=True)
111111
url = self.api.access_token_url
112-
response, content = http_object.request(url, method="POST", body=data)
112+
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
113+
response, content = http_object.request(url, method="POST", headers=headers, body=data)
113114
parsed_content = simplejson.loads(content.decode())
114115
if int(response['status']) != 200:
115116
raise OAuth2AuthExchangeError(parsed_content.get("error_message", ""))

0 commit comments

Comments
 (0)