Mercurial > code > home > repos > homeauto
view service/reasoning/rdflibtrig.py @ 1047:e3d77b7f16ca
rearrange Actions
Ignore-this: abd7b4dbaa1e83f071ae898b78344068
darcs-hash:84c6fae3fc79b2ecc0556a2dc1362add830c2998
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Tue, 02 Feb 2016 01:52:29 -0800 |
parents | a328cc370b22 |
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