Skip to content

Instantly share code, notes, and snippets.

@fmasanori
Created February 1, 2013 12:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fmasanori/4691077 to your computer and use it in GitHub Desktop.
Save fmasanori/4691077 to your computer and use it in GitHub Desktop.
Python 3.x Reddit Client
import urllib.request
import json
url = 'http://www.reddit.com/r/Python/.json'
resp = urllib.request.urlopen(url).read()
parsed = json.loads(resp.decode('utf-8'))
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