Skip to content

Commit 57dc96c

Browse files
author
Mike Krieger
committed
adding min/max timestamp support
v2->v1
1 parent 32fbc11 commit 57dc96c

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

get_access_token.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
from instagram.client import InstagramAPI
2-
3-
try:
4-
from test_settings import *
5-
6-
InstagramAPI.host = test_host
7-
InstagramAPI.base_path = test_base_path
8-
InstagramAPI.access_token_field = "access_token"
9-
InstagramAPI.authorize_url = test_authorize_url
10-
InstagramAPI.access_token_url = test_access_token_url
11-
InstagramAPI.protocol = test_protocol
12-
except Exception:
13-
pass
2+
import sys
3+
4+
if len(sys.argv) > 1 and sys.argv[1] == 'local':
5+
try:
6+
from test_settings import *
7+
8+
InstagramAPI.host = test_host
9+
InstagramAPI.base_path = test_base_path
10+
InstagramAPI.access_token_field = "access_token"
11+
InstagramAPI.authorize_url = test_authorize_url
12+
InstagramAPI.access_token_url = test_access_token_url
13+
InstagramAPI.protocol = test_protocol
14+
except Exception:
15+
pass
1416

1517
client_id = raw_input("Client ID: ").strip()
1618
client_secret = raw_input("Client Secret: ").strip()

instagram/bind.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ def _do_api_request(self, url):
8282
response, content = OAuth2Request(self.api).make_request(url)
8383
if response['status'] == '503':
8484
raise InstagramAPIError(response['status'], "Rate limited", "Your client is making too many request per second")
85-
elif response['status'] != '200':
86-
raise InstagramAPIError(response['status'], "Server error", "The API server returned an error")
8785
content_obj = simplejson.loads(content)
8886
response_objects = []
8987
status_code = content_obj['meta']['code']

instagram/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class InstagramAPI(oauth2.OAuth2API):
1212

1313
host = "api-privatebeta.instagr.am"
14-
base_path = "/v2"
14+
base_path = "/v1"
1515
access_token_field = "access_token"
1616
authorize_url = "http://api-privatebeta.instagr.am/oauth/authorize"
1717
access_token_url = "http://api-privatebeta.instagr.am/oauth/access_token"
@@ -33,7 +33,7 @@ def __init__(self, *args, **kwargs):
3333

3434
media_search = bind_method(
3535
path = "/media/search",
36-
accepts_parameters = SEARCH_ACCEPT_PARAMETERS + ['ll'],
36+
accepts_parameters = SEARCH_ACCEPT_PARAMETERS + ['ll', 'min_timestamp', 'max_timestamp'],
3737
root_class = Media)
3838

3939
user_media_feed = bind_method(

0 commit comments

Comments
 (0)