-
-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web: Fix for new query_hash + gis signed header requirement.
Users should now also persist the ``rhx_gis`` value along with the cookie string. Fixes #66
- Loading branch information
Showing
6 changed files
with
131 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
from ..common import WebApiTestBase | ||
|
||
|
||
class UnauthenticatedTests(WebApiTestBase): | ||
"""Tests for endpoints with authentication""" | ||
|
||
@staticmethod | ||
def init_all(api): | ||
return [ | ||
{ | ||
'name': 'test_unauthenticated_tag_feed', | ||
'test': UnauthenticatedTests('test_unauthenticated_tag_feed', api), | ||
}, | ||
{ | ||
'name': 'test_unauthenticated_user_feed', | ||
'test': UnauthenticatedTests('test_unauthenticated_user_feed', api), | ||
}, | ||
{ | ||
'name': 'test_unauthenticated_location_feed', | ||
'test': UnauthenticatedTests('test_unauthenticated_location_feed', api), | ||
}, | ||
{ | ||
'name': 'test_unauthenticated_media_comments', | ||
'test': UnauthenticatedTests('test_unauthenticated_media_comments', api), | ||
}, | ||
{ | ||
'name': 'test_unauthenticated_media_comments_noextract', | ||
'test': UnauthenticatedTests('test_unauthenticated_media_comments_noextract', api), | ||
}, | ||
] | ||
|
||
def test_unauthenticated_tag_feed(self): | ||
results = self.api.tag_feed('catsofinstagram').get('data', {}) | ||
self.assertIsNotNone(results.get('hashtag', {}).get('name')) | ||
self.assertGreater( | ||
len(results.get('hashtag', {}).get('edge_hashtag_to_media', {}).get('edges', [])), 0) | ||
self.assertGreater( | ||
len(results.get('hashtag', {}).get('edge_hashtag_to_top_posts', {}).get('edges', [])), 0) | ||
|
||
def test_unauthenticated_user_feed(self): | ||
results = self.api.user_feed(self.test_user_id) | ||
self.assertGreater(len(results), 0) | ||
self.assertIsInstance(results, list) | ||
self.assertIsInstance(results[0], dict) | ||
|
||
def test_unauthenticated_location_feed(self): | ||
results = self.api.location_feed('212988663').get('data', {}) | ||
self.assertIsNotNone(results.get('location', {}).get('name')) | ||
self.assertGreater( | ||
len(results.get('location', {}).get('edge_location_to_media', {}).get('edges', [])), 0) | ||
self.assertGreater( | ||
len(results.get('location', {}).get('edge_location_to_top_posts', {}).get('edges', [])), 0) | ||
|
||
def test_unauthenticated_media_comments(self): | ||
results = self.api.media_comments(self.test_media_shortcode, count=20) | ||
self.assertGreaterEqual(len(results), 0) | ||
self.assertIsInstance(results, list) | ||
self.assertIsInstance(results[0], dict) | ||
|
||
def test_unauthenticated_media_comments_noextract(self): | ||
results = self.api.media_comments(self.test_media_shortcode, count=20, extract=False) | ||
self.assertIsInstance(results, dict) |
bd776f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! How did you recognize this logic as md5? Was it lucky guess or something?
bd776f1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ping Hey, awesome job. I'm trying to port these changes over to a JS repo I have, but I'm running into issues. If you have a moment, is there anything different I'm doing that is resulting in me continuing to get
403
's? https://stackoverflow.com/questions/49786980