Mercurial > code > home > repos > homeauto
view service/reasoning/rdflibtrig.py @ 240:0c306e76d8c5
ipv6 fetch support. refactor Actions to new class and file
Ignore-this: 200d7093919cf001706ad9c02347fabb
author | drewp@bigasterisk.com |
---|---|
date | Mon, 01 Feb 2016 03:28:17 -0800 |
parents | 5ad229334a88 |
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