使用 Paste.ee api 时在 PythonAnywhere 中不断出现错误

Keep getting an error in PythonAnywhere while using Paste.ee api

我在我的应用程序中使用 paste.ee api,但我不断收到以下错误:

requests.exceptions.ProxyError: HTTPSConnectionPool(host='api.paste.ee', port=443): Max retries exceeded with url: /v1/pastes (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

代码在我的本地机器上工作正常,但我在这里遇到上述错误。有人可以帮我解决这个问题吗?

根据 the documentation,您需要向 paste.ee 提供一个 API 密钥,否则您将收到 403 错误(这就是您似乎得到的).
The documentation has a section mentioning how you get an API key.

您是免费用户吗? PythonAnywhere 上的免费用户限制互联网访问白名单域(通常是开放和 public API)。如果您尝试访问的端点尚未列入白名单,您可以通过向工作人员提供 link 官方文档(在论坛上或通过电子邮件)来请求添加它。