RDFLib’s URL Loader Can Use urllib’s Proxy Environment
Configure the urllib URL-loading path before RDFLib parses a remote document instead of expecting another Requests call’s options to propagate.
RDFLib’s URLInputSource downloads through urllib.request. Configure urllib’s normal proxy environment before first using that URL loader:
import os
from rdflib import Graph
os.environ['http_proxy'] = 'http://proxy.example:8080'
os.environ['https_proxy'] = 'http://proxy.example:8080'
graph = Graph()
graph.parse('https://data.example/catalog.ttl', format='turtle')
Both variables identify the same HTTP proxy listener. They cover the respective destination schemes, including an HTTPS RDF document. For public RDF sources on a permitted public-proxy route, the HTTP proxy list supplies candidates for these environment URLs.
If the process already installed or constructed a custom urllib opener, inspect its proxy handler. A later environment change does not necessarily rebuild that handler.
Use the loader named in the traceback when another download fails. RDF plugins and application wrappers can own additional network paths. A proxy argument on a separate Requests call applies to that call rather than to RDFLib’s urllib loader.