gpt4 book ai didi

python - 如何将 Python Sentry SDK (raven-python) 与 HTTP 代理结合使用

转载 作者:行者123 更新时间:2023-12-01 09:09:33 27 4
gpt4 key购买 nike

我有一个网络应用程序,它使用 raven-python SDK for Sentry 进行错误报告。我希望该 SDK 的出站请求通过 HTTP 代理。

最好的方法是什么?

最佳答案

您可以使用替代方案 Transport such as the requests one 。通过请求传输,您可以使用环境变量来设置代理:http://docs.python-requests.org/en/master/user/advanced/#proxies

示例:

from raven.transport.threaded_requests import ThreadedRequestsHTTPTransport

Client('...', transport=ThreadedRequestsHTTPTransport)

在您的环境中,设置HTTPS_PROXY=https://localhost:9090 或类似的内容。

关于python - 如何将 Python Sentry SDK (raven-python) 与 HTTP 代理结合使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51772831/

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