Mercurial > code > home > repos > homeauto
view service/reasoning/rdflibtrig.py @ 247:b0089d1ca4f6
add bed buttons
Ignore-this: 912a92f7a8e173fe64aa4c1df9ef7dba
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 Feb 2016 23:48:29 -0800 |
parents | 0c306e76d8c5 |
children | e5c27d2f11ab |
line wrap: on
line source
import time import requests from rdflib import ConjunctiveGraph def addTrig(graph, url, timeout=2): t1 = time.time() response = requests.get(url, stream=True, timeout=timeout) if response.status_code != 200: raise ValueError("status %s from %s" % (response.status, url)) g = ConjunctiveGraph() g.parse(response.raw, format='trig') fetchTime = time.time() - t1 graph.addN(g.quads()) return fetchTime