gpt4 book ai didi

python - 在代理后面使用 Jupyter

转载 作者:IT老高 更新时间:2023-10-28 20:40:58 25 4
gpt4 key购买 nike

是否有与 .condarc (anaconda 4.0.0) 类似的配置,允许将 Jupyter 配置为在本地计算机上的公司代理后面工作?

收到错误:

HTTPError: HTTP Error 407: Proxy Authentication Required

最佳答案

更简单:只需将以下内容添加到您的笔记本中:

In [1]: import os
os.environ['http_proxy'] = "http://user:passwd@host:port"
os.environ['https_proxy'] = "https://user:passwd@host:port"

之后,请求将起作用 OK=200 ,例如

In [2]: import requests
requests.get("https://google.com")
Out[2]: <Response [200]>

关于python - 在代理后面使用 Jupyter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36629707/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com