diff --git a/.gitignore b/.gitignore index 70accf66..96e763e3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,5 @@ .DS_Store *.swp test_settings.py - +.idea build diff --git a/instagram/models.py b/instagram/models.py index 1f4ad3c3..a823cddc 100644 --- a/instagram/models.py +++ b/instagram/models.py @@ -205,6 +205,11 @@ def __init__(self, id, *args, **kwargs): def __unicode__(self): return "User: %s" % self.username + def __eq__(self, other): + return self.id == other.id + + def __ne__(self, other): + return not self == other class Relationship(ApiModel): diff --git a/instagram/oauth2.py b/instagram/oauth2.py index 053b1be8..1011389e 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) + headers = {'Content-Type': 'application/x-www-form-urlencoded'} + response, content = http_object.request(url, method="POST", headers=headers, body=data) parsed_content = simplejson.loads(content.decode()) if int(response['status']) != 200: raise OAuth2AuthExchangeError(parsed_content.get("error_message", ""))