The Python Requests module uses an environment variable proxy. So let's set it as an environment variable.
By calling the following function at the beginning of main, you will be able to exit the proxy with requests.
import os
# Proxy setting
def proxy_setting():
proxy_user = 'proxy_user'
proxy_pass = 'proxy_pass'
proxy_url = '******:8080'
os.environ["http_proxy"] = 'http://' + proxy_user + ':' + proxy_pass + '@' + proxy_url
os.environ["https_proxy"] = 'http://' + proxy_user + ':' + proxy_pass + '@' + proxy_url
Recommended Posts