Created
May 5, 2013 10:47
-
-
Save peppelorum/5520468 to your computer and use it in GitHub Desktop.
Consuming WeLovePublicService's SVTPlay API with requests and rethinkdb
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
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