Created
December 12, 2013 23:54
-
-
Save nikolak/7937762 to your computer and use it in GitHub Desktop.
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
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