pac(proxy auto config),if proxy is enable i want use it automatically,pac is the key to solving the problem。
python requests requests library in terminal do not use system proxy,unless "export http_proxy=http://127.0.0.1:1087;export https_proxy=http://127.0.0.1:1087;export ALL_PROXY=socks5://127.0.0.1:1080"
now i have run "pyinstaller --windowed main.py" that package a app,but do not use system proxy automatically,
I want python's requests library use v2ray's proxy automatically
when is enable global proxy,I found that the environment variable doesn't have an http_proxy or https_proxy or ALL_PROXY.
It's hard coded, not so good. What I want is the browser effect, the browser can not access the site through the proxy access
import requests
proxies = {
'http': 'http://proxy.example.com:8080',
'https': 'http://proxy.example.com:8080',
}
response = requests.get('http://example.com', proxies=proxies)
how to resolve it?
You can use
osmodule to load proxy infomation instead of hard coded.Remember set environment variables before running your script: