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

Commit d46e0eb

Browse files
committed
Fixes all tests failing because of None secret passed to hmac.new introduced in 79c41e1
- All tests were previously failing with error `TypeError: object of `NoneType` has no len()`: https://travis-ci.org/Instagram/python-instagram/jobs/58567079 - If we weren't given a `client_secret`, we don't have a secret to sign the request with, so `_signed_request()` should just return the empty string.
1 parent 9ea533e commit d46e0eb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

instagram/oauth2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _generate_sig(self, endpoint, params, secret):
124124
sig = endpoint
125125
for key in sorted(params.keys()):
126126
sig += '|%s=%s' % (key, params[key])
127-
return hmac.new(secret, sig, sha256).hexdigest()
127+
return hmac.new(secret, sig, sha256).hexdigest()
128128

129129
def url_for_get(self, path, parameters):
130130
return self._full_url_with_params(path, parameters)
@@ -162,7 +162,7 @@ def _auth_query(self, include_secret=False):
162162
return base
163163

164164
def _signed_request(self, path, params, include_signed_request, include_secret):
165-
if include_signed_request:
165+
if include_signed_request and self.api.client_secret is not None:
166166
if self.api.access_token:
167167
params['access_token'] = self.api.access_token
168168
elif self.api.client_id:

0 commit comments

Comments
 (0)