carsonyl / pypac

Find and use proxy auto-config (PAC) files with Python and Requests.
https://pypac.readthedocs.io
Apache License 2.0
71 stars 18 forks source link

HTTPS proxy and non-PACsession update #44

Closed SeyfSV closed 4 years ago

SeyfSV commented 4 years ago

Hi, Pypac does not allow to set session options before pac file reading, session.headers for example. Some services that provide pac file checks User-Agent and provide different responses. That is why I changed it, to allow this:

session = PACSession()
session.headers.update({'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0'})
pac = session.get_pac(url='https://antizapret.prostovpn.org/proxy.pac')

Also I added HTTPS value to the valid values in proxy_url()

carsonyl commented 4 years ago

Oops, I meant to "request changes" instead.

SeyfSV commented 4 years ago

On my machine all tests passed now except test_timeout_proxy, it returns ProxyError instead of ConnectTimeout

carsonyl commented 4 years ago

Thanks again for your contribution.