Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

removed unused imports and pep8 fixes #236

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions instagram/bind.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import urllib
from .oauth2 import OAuth2Request
import re
from .json_import import simplejson
import hmac
from hashlib import sha256
import six
from six.moves.urllib.parse import quote
import sys

re_path_template = re.compile('{\w+}')

Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion instagram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 1 addition & 3 deletions instagram/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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']:
Expand Down
4 changes: 2 additions & 2 deletions instagram/oauth2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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)
1 change: 1 addition & 0 deletions instagram/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import hashlib
from .json_import import simplejson


class SubscriptionType:
TAG = 'tag'
USER = 'user'
Expand Down