Always appears to return {} from conn regardless of id. Confused

nopraw
David Trail 13 years ago
parent a1f6b27d22
commit 10b7dcc3fa

@ -52,16 +52,16 @@ for dat in deletion_ids:
subreddit = dat['subreddit'] subreddit = dat['subreddit']
text = dat[u'body'][:20] text = dat[u'body'][:20]
print '{time} {subreddit}: "{text}..."'.format(subreddit=subreddit, id=id, time=time, text=text) print '{id}: {time} {subreddit}: "{text}..."'.format(subreddit=subreddit, id=id, time=time, text=text)
# And now for the deleting # And now for the deleting
conn = httplib.HTTPConnection('www.reddit.com') conn = httplib.HTTPConnection('www.reddit.com')
params = urllib.urlencode({ params = urllib.urlencode({
'id': dat['id'], 'id': id,
'uh': modhash, 'uh': modhash,
'api_type': 'json'}) 'api_type': 'json'})
conn.request('POST', '/api/del', params, headers) conn.request('POST', '/api/del', params, headers)
http = conn.getresponse() http = conn.getresponse()
if http.read() != '{}': print http.read()
print '''Failed to delete "%s" (%s - %s - %s)''' % (text, id, time, subreddit) #print '''Failed to delete "%s" (%s - %s - %s)''' % (text, id, time, subreddit)
break # Still in-testing break
sleep(2) sleep(2)

Loading…
Cancel
Save