[Twisted-Python] web client and proxy
Hi, My english is very bad, sorry... I don't understand how to access to a web server behind a proxy from web.client ? somebody could explain me how to do? thanks Olivier Fournier
Olivier Fournier wrote:
Hi,
My english is very bad, sorry...
I don't understand how to access to a web server behind a proxy from web.client ? somebody could explain me how to do?
thanks
Here is a modified version of web.client.getPage() that I use behind a proxy: def getPage(url, contextFactory=None, *args, **kwargs): scheme, host, port, path = _parse(url) factory = HTTPClientFactory(url, *args, **kwargs) if 1: # use a proxy host, port = 'proxy', 6060 factory.path = url if scheme == 'https': from twisted.internet import ssl if contextFactory is None: contextFactory = ssl.ClientContextFactory() reactor.connectSSL(host, port, factory, contextFactory) else: reactor.connectTCP(host, port, factory) return factory.deferred Hope this helps, -- Amaury Forgeot d'Arc
participants (2)
-
Amaury Forgeot d'Arc -
Olivier Fournier