【问题标题】:Using a proxy that requires authentication with pybliometrics使用需要通过 pybliometrics 进行身份验证的代理
【发布时间】:2020-06-08 12:36:53
【问题描述】:

我正在使用 pybliometrics,Scopus API 的 Python 接口,下载一些论文的摘要。

很遗憾,Scopus 只能在订阅它的大学网络内工作。我目前在家,每当我尝试使用 pybliometrics 下载内容时,都会出现以下错误:

pybliometrics.scopus.exception.Scopus401Error: The requestor is not authorized to access the requested view or fields of the resource

我需要使用我大学的代理才能使用我大学的 IP 地址进入互联网。代理有一个可用的 WPAD 配置文件,但我不知道如何将它与 pybliometrics 一起使用。 pybliometrics documentation 表示要在配置文件中添加一个块,如下所示:

[Proxy]
ftp = socks5://127.0.0.1:1234
http = socks5://127.0.0.1:1234
https = socks5://127.0.0.1:1234

但是这个代理需要认证。如何指定代理用户名和密码?

编辑:我尝试在 config.ini 中设置块,例如:

[Proxy]
ftp = http://username:password@proxy.thing.it:8080
http = http://username:password@proxy.thing.it:8080
https = http://username:password@proxy.thing.it:8080

但它仍然失败并显示以下错误消息:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.elsevier.com', port=443): Max retries exceeded with url: /content/abstract/scopus_id/84983158344?view=META_ABS (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

【问题讨论】:

    标签: proxy http-proxy socks scopus pybliometrics


    【解决方案1】:

    从我们的角度来看,只要代理配置正确,API 就会通过代理工作。我建议您与代理提供商联系,看看他们是否可以提供帮助。

    我们没有关于如何通过代理使用 API 的具体说明(因为有许多潜在的不同版本和潜在配置);但是,一般说明在这里:

    https://service.elsevier.com/app/answers/detail/a_id/29026/supporthub/elsevieraccess/

    【讨论】:

    • 是的,问题是我的代理需要 DigestAuth 而不是 BasicAuth。谢谢!
    【解决方案2】:

    在我看来,您的新代理块看起来很可疑。它也通过 http 汇集 ftp 和 https 请求。也许在相应的部分尝试 ftp 和 https 作为协议。

    另一种解决方案是向 Scopus 集成支持部门询问 InstToken,您可以使用它来代替代理。然后,您也可以在配置文件中指定 InstToken。

    【讨论】:

    • 问题是我的代理需要 DigestAuth 而不是 BasicAuth。谢谢!
    【解决方案3】:

    问题是我的代理需要 DigestAuth 而不是 BasicAuth。

    【讨论】:

      猜你喜欢
      • 2012-11-10
      • 1970-01-01
      • 2018-09-29
      • 2010-09-06
      • 2021-10-10
      • 1970-01-01
      • 2017-07-02
      • 2012-04-07
      • 1970-01-01
      相关资源
      最近更新 更多