Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Last active April 21, 2019 08:12
Show Gist options
  • Save fmasanori/4126108 to your computer and use it in GitHub Desktop.
Save fmasanori/4126108 to your computer and use it in GitHub Desktop.
Python Reddit Client
import json
import urllib
url = 'http://www.reddit.com/r/Python/.json'
resp = urllib.urlopen(url).read()
parsed = json.loads(resp)
for item in parsed['data']['children']:
doc = item['data']
print doc['title']
print '#comments: %d' %doc['num_comments']
print doc['url']
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment