diff --git a/instagram/bind.py b/instagram/bind.py index cce758bf..4f1d90ac 100644 --- a/instagram/bind.py +++ b/instagram/bind.py @@ -1,4 +1,3 @@ -import urllib from .oauth2 import OAuth2Request import re from .json_import import simplejson @@ -6,7 +5,6 @@ from hashlib import sha256 import six from six.moves.urllib.parse import quote -import sys re_path_template = re.compile('{\w+}') @@ -113,7 +111,7 @@ def _build_pagination_info(self, content_obj): if self.pagination_format == 'dict': return pagination raise Exception('Invalid value for pagination_format: %s' % self.pagination_format) - + def _do_api_request(self, url, method="GET", body=None, headers=None): headers = headers or {} if self.signature and self.api.client_ips != None and self.api.client_secret != None: @@ -137,8 +135,8 @@ def _do_api_request(self, url, method="GET", body=None, headers=None): raise InstagramAPIError(content_obj.get('code'), content_obj.get('error_type'), content_obj.get('error_message')) api_responses = [] status_code = content_obj['meta']['code'] - self.api.x_ratelimit_remaining = response.get("x-ratelimit-remaining",None) - self.api.x_ratelimit = response.get("x-ratelimit-limit",None) + self.api.x_ratelimit_remaining = response.get("x-ratelimit-remaining", None) + self.api.x_ratelimit = response.get("x-ratelimit-limit", None) if status_code == 200: if not self.objectify_response: return content_obj, None diff --git a/instagram/client.py b/instagram/client.py index 624bc0ec..45205711 100644 --- a/instagram/client.py +++ b/instagram/client.py @@ -17,7 +17,7 @@ class InstagramAPI(oauth2.OAuth2API): access_token_url = "https://api.instagram.com/oauth/access_token" protocol = "https" api_name = "Instagram" - x_ratelimit_remaining = None + x_ratelimit_remaining = None x_ratelimit = None def __init__(self, *args, **kwargs): diff --git a/instagram/models.py b/instagram/models.py index d2517ca2..0ec50e36 100644 --- a/instagram/models.py +++ b/instagram/models.py @@ -62,11 +62,9 @@ def get_low_resolution_url(self): else: return self.videos['low_resolution'].url - def get_thumbnail_url(self): return self.images['thumbnail'].url - def __unicode__(self): return "Media: %s" % self.id @@ -112,7 +110,7 @@ def object_from_dictionary(cls, entry): new_media.caption = None if entry['caption']: new_media.caption = Comment.object_from_dictionary(entry['caption']) - + new_media.tags = [] if entry['tags']: for tag in entry['tags']: diff --git a/instagram/oauth2.py b/instagram/oauth2.py index 053b1be8..e64d76d0 100644 --- a/instagram/oauth2.py +++ b/instagram/oauth2.py @@ -144,7 +144,7 @@ def _full_url(self, path, include_secret=False, include_signed_request=True): self._signed_request(path, {}, include_signed_request, include_secret)) def _full_url_with_params(self, path, params, include_secret=False, include_signed_request=True): - return (self._full_url(path, include_secret) + + return (self._full_url(path, include_secret) + self._full_query_with_params(params) + self._signed_request(path, params, include_signed_request, include_secret)) @@ -234,5 +234,5 @@ def make_request(self, url, method="GET", body=None, headers=None): headers.update({"User-Agent": "%s Python Client" % self.api.api_name}) # https://github.com/jcgregorio/httplib2/issues/173 # bug in httplib2 w/ Python 3 and disable_ssl_certificate_validation=True - http_obj = Http() if six.PY3 else Http(disable_ssl_certificate_validation=True) + http_obj = Http() if six.PY3 else Http(disable_ssl_certificate_validation=True) return http_obj.request(url, method, body=body, headers=headers) diff --git a/instagram/subscriptions.py b/instagram/subscriptions.py index d84d1fe9..22ba5e77 100644 --- a/instagram/subscriptions.py +++ b/instagram/subscriptions.py @@ -2,6 +2,7 @@ import hashlib from .json_import import simplejson + class SubscriptionType: TAG = 'tag' USER = 'user'