Skip to content

Instantly share code, notes, and snippets.

@nikolak
Created December 12, 2013 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikolak/7937762 to your computer and use it in GitHub Desktop.
Save nikolak/7937762 to your computer and use it in GitHub Desktop.
removed_counter=0
for x in range(0,len(to_update),100):
items=to_update[x:x+100]
items_url=api_by_id.format(",".join(items))
request_time=time()
print "[FILTERING] Starting request...",request_time
# print "Request url", items_url
try:
r=requests.get(items_url, headers=headers, timeout=20)
except:
print "Filtering failed, retrying..."
return False
r_json=r.json()
sub_list=r_json['data']['children']
for sub in sub_list:
sub=sub['data']
if sub['name'] in to_check:
submissions.get(sub['name'])
if sub['score']<submissions.get(sub['name'])['last_score']+10 and sub['score']<500:
submissions.pop(sub['name'])
removed_counter+=1
else:
# print "Updated", sub['name']
submissions[sub['name']]['last_check']=time()
submissions[sub['name']]['last_score']=sub['score']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment