I use the below to starting the reactor for fetching web pages... So...all pages I fetch use the proxy once the reactor starts. But...what if I want to rotate proxies? How do I do that using eg random.choice(proxy_list)
Thanks
site = server.Site(proxy.ReverseProxyResource('173.000.342.234', 8800, ''))
reactor.listenTCP(8080, site)
reactor.run()
Take a look at the implementation . Notice where it uses the supplied IP and port to set up a new connection with reactor.connectTCP
. Subclass ReverseProxyResource
and extend it to be able to connect to your randomly selected address.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.