Skip to content

Instantly share code, notes, and snippets.

@peppelorum
Created May 5, 2013 10:47
Show Gist options
  • Save peppelorum/5520468 to your computer and use it in GitHub Desktop.
Save peppelorum/5520468 to your computer and use it in GitHub Desktop.
Consuming WeLovePublicService's SVTPlay API with requests and rethinkdb
import requests
from rethinkdb.errors import RqlRuntimeError
import rethinkdb as r
r.connect('localhost', 28015).repl()
try:
r.db('wlps').table_create('episode').run()
except RqlRuntimeError:
pass
req = requests.get('http://api.welovepublicservice.se/v1/episode/')
allt = req.json()
for grej in allt['objects']:
r.db('wlps').table('episode').insert(grej).run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment