Proxy Type Definition

I have the following code to download a URL through a proxy:

proxy_handler = urllib2.ProxyHandler({'http': p})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
req = urllib2.Request(url)
sock = urllib2.urlopen(req)

How can I use Python to determine the type of proxy server (transparent, anonymous, etc.)? One solution would be to use an external server, but I want to avoid a possible dependency, if possible.

+3
source share
2 answers

One solution would be to use an external server

You must have some kind of server.

The best option you can hope to do is host your own web server and print the headers to see if any variables are leaking.

+1
source

-? urllib.getproxies:

import urllib
urllib.getproxies()
{'http': 'http://your_proxy_servername:8080'}

. urllib.getproxies. Python 2.5, .

-1

Source: https://habr.com/ru/post/1712402/


All Articles