Created
April 21, 2017 10:51
-
-
Save mizvol/ce96d0217516dcd1aca9a39bce55e6e5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
from requests import get, Session, adapters | |
def getInstaPosts(latitude, longitude, distance, minTimestamp, maxTimestamp, count): | |
params = { | |
'lat': latitude, | |
'lng': longitude, | |
'distance': distance, # radius of requested area | |
'min_timestamp': str(minTimestamp), #start date | |
'max_timestamp': str(maxTimestamp), #end date | |
'count': COUNT, # number of posts(100 max) | |
'access_token': INSTAGRAM_ACCESS_TOKEN #your access token | |
} | |
session = Session() | |
session.mount("https://", adapters.HTTPAdapter(max_retries=10)) | |
response = session.get("https://api.instagram.com/v1/media/search", params=params, verify=True) | |
return response.json() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment