/usr/lib/python2.7/dist-packages/rdflib/URLInputSource.py is in python-rdflib 2.4.2-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | from urllib2 import urlopen, Request
from xml.sax.xmlreader import InputSource
from rdflib import __version__
# TODO: add types for n3. text/rdf+n3 ?
headers = {
'Accept': 'application/rdf+xml,application/xhtml+xml;q=0.5',
'User-agent':
'rdflib-%s (http://rdflib.net/; eikeon@eikeon.com)' % __version__
}
class URLInputSource(InputSource, object):
def __init__(self, system_id=None):
super(URLInputSource, self).__init__(system_id)
self.url = system_id
# So that we send the headers we want to...
req = Request(system_id, None, headers)
file = urlopen(req)
self.setByteStream(file)
# TODO: self.setEncoding(encoding)
def __repr__(self):
return self.url
|