我saw人们在使用Instagram API大约一个月前遇到了500个内部服务器错误的问题,但我还是得到了它,其他帖子说这些问题已得到解决。这是我用来从Instagram获取历史特定位置数据的Python代码 - 我做错了吗?
import urllib2
import time
outFileName = "instagramData.txt"
out = open(outFileName, "wb")
startTime = 1379249920
while startTime <= 1381841920:
for i in range(0,4500):
urlStr = "https://api.instagram.com/v1/media/search?lat=SOMELAT&lng=SOMELONG&distance=4000&min_timestamp=" + `startTime` + "&max_timestamp=" + `startTime + 5` + "&access_token=****"
print urlStr
try:
response = urllib2.urlopen(urlStr)
html = response.read()
except Exception:
time.sleep(5)
continue
out.write(html)
startTime += 5
time.sleep(.8)