Python 将urllib.request与代理一起使用

Python 将urllib.request与代理一起使用,python,python-3.x,proxy,download,Python,Python 3.x,Proxy,Download,当我在办公室时,我需要使用python脚本下载一个文件。。。长期目标是把这个发给我的队友,但需要解决代理问题 这是我现在正在使用的代码 import urllib.request import shutil url = "https://download/app/client/app.exe" output_file = "C:\\Desktop\\testing\\App.exe" with urllib.request.urlopen(url) as response, open(outp

当我在办公室时,我需要使用python脚本下载一个文件。。。长期目标是把这个发给我的队友,但需要解决代理问题

这是我现在正在使用的代码

import urllib.request
import shutil

url = "https://download/app/client/app.exe"
output_file = "C:\\Desktop\\testing\\App.exe"
with urllib.request.urlopen(url) as response, open(output_file, 'wb') as out_file:
    shutil.copyfileobj(response, out_file)

当我启动这个脚本时,它只是挂起,我知道这是因为代理问题。。。。如何将其设置为使用我的公司代理?理想情况下,使用基于位置(家庭与办公室)的代理设置会很好,但我会尽我所能

也许这个答案会有帮助,或者这个答案可能会有帮助,或者这个答案会有帮助