如何将代理 PAC 文件用于 python urllib 或请求? [英] How to use Proxy PAC file for python urllib or request?

查看:108
本文介绍了如何将代理 PAC 文件用于 python urllib 或请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 HTTP 库中包含我的自动代理配置文件,例如urllib 或请求.

How do I include my automatic proxy config file in HTTP libraries like urllib or requests.

pacfile = 'http://myintranet.com/proxies/ourproxies.pac'
proxy = urllib3.ProxyManager(????????????????)

推荐答案

当前不支持直接在 urllib3 或 requests 中的代理 PAC 文件.尽管原则上可以为代理 PAC 文件添加支持,因为它们是需要解释的 Javascript 文件,因此提供广泛的支持可能极其困难.

Current there is no support for a proxy PAC file directly in urllib3 or requests. While support could in principle be added for proxy PAC files, because they are Javascript files that require interpretation it is likely to be extremely difficult to provide broad-based support.

原则上,您可以使用 requests/urllib3 来请求代理 PAC 文件,然后将其传递给 Node.JS 之类的内容进行解释,然后在 Python 中解析结果以传递给 urllib3/requests,但没有类似的内容存在盒子里.

In principle you could use requests/urllib3 to request the Proxy PAC file, then pass it to something like Node.JS for interpreting, then parse the results back in Python to pass to urllib3/requests, but nothing like that exists out of the box.

这篇关于如何将代理 PAC 文件用于 python urllib 或请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆