简体   繁体   中英

How do I configure Python to use the same proxy settings of my computer

I am tired of configuring proxy settings for all my Python scripts, specially because my work computer is configured with a PAC file.

Can I turn on some "Use system proxy" in Python and forget that proxies exist?

If you use the requests module, then you can set environment variables in your .bashrc or .profile files and they'll get used automatically. Or you can use PyPAC module to make use of the .pac file

export HTTP_PROXY="http://10.10.1.10:3128"
export HTTPS_PROXY="http://10.10.1.10:1080"

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM