- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试按照 https://github.com/airbrake/airbrake-django#manually-sending-errors-to-airbrake 上的示例进行操作手动向 Airbrake 发送错误消息。首先,我启动 Django shell:
(venv) Kurts-MacBook-Pro-2:lucy-web kurtpeek$ ENV_ROLE=staging python manage.py shell
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.3.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from django.conf import settings
AIRBRAKE
设置已定义的环境:
In [6]: settings.AIRBRAKE
Out[6]:
{'API_KEY': '<airbrake_api_key>',
'TIMEOUT': 5,
'ENVIRONMENT': 'staging'}
但是,如果我尝试调用 Airbrakes Client.notify
方法,我会得到一个 SSLError
:
In [7]: from airbrake.utils.client import Client
In [8]: airbrake = Client()
In [9]: error = Exception("This is a test exception")
In [10]: airbrake.notify(error)
---------------------------------------------------------------------------
SSLError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1317 h.request(req.get_method(), req.selector, req.data, headers,
-> 1318 encode_chunked=req.has_header('Transfer-encoding'))
1319 except OSError as err: # timeout error
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in request(self, method, url, body, headers, encode_chunked)
1238 """Send a complete request to the server."""
-> 1239 self._send_request(method, url, body, headers, encode_chunked)
1240
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1284 body = _encode(body, 'body')
-> 1285 self.endheaders(body, encode_chunked=encode_chunked)
1286
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in endheaders(self, message_body, encode_chunked)
1233 raise CannotSendHeader()
-> 1234 self._send_output(message_body, encode_chunked=encode_chunked)
1235
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in _send_output(self, message_body, encode_chunked)
1025 del self._buffer[:]
-> 1026 self.send(msg)
1027
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in send(self, data)
963 if self.auto_open:
--> 964 self.connect()
965 else:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py in connect(self)
1399 self.sock = self._context.wrap_socket(self.sock,
-> 1400 server_hostname=server_hostname)
1401 if not self._context.check_hostname and self._check_hostname:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
406 server_hostname=server_hostname,
--> 407 _context=self, _session=session)
408
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in __init__(self, sock, keyfile, certfile, server_side, cert_reqs, ssl_version, ca_certs, do_handshake_on_connect, family, type, proto, fileno, suppress_ragged_eofs, npn_protocols, ciphers, server_hostname, _context, _session)
813 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 814 self.do_handshake()
815
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in do_handshake(self, block)
1067 self.settimeout(None)
-> 1068 self._sslobj.do_handshake()
1069 finally:
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/ssl.py in do_handshake(self)
688 """Start the SSL/TLS handshake."""
--> 689 self._sslobj.do_handshake()
690 if self.context.check_hostname:
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:777)
来自 Python requests SSL error - certificate verify failed ,在这种情况下你似乎需要一个证书,我想我的本地 Django shell 没有。可能无法以这种方式使用 Airbrake 吗?我将如何测试手动添加的通知是否已发送?
最佳答案
感谢使用 Airbrake !
如果可以,请升级到最新的 Python 通知程序 pybrake原生支持 Python 3.+ .
关于如何集成的说明 pybrake与 Django 位于 here
关于具体问题
SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败
看来 macOS 可能没有所需/更新的 CA 证书。
免责声明:我为 Airbrake 工作
关于python - Airbrake-Django 引起 SSLError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50537494/
您好,我正在尝试通过执行从表存储帐户查询数据的 python 脚本来开始 Azure ML 算法。我用这个来做: entities_Azure=table_session.query_entities
我有一个运行 omniauth-facebook 和 omniauth-twitter 的 Rails 4 应用程序,但所有登录尝试都会遇到 Faraday::SSLError -- SSL_conn
我在 python 中使用一个包,我试图通过简单的打印访问方法我想出了这个错误 ConnectionError: HTTPSConnectionPool(host='xxx.xxxxx.xxx', p
import sslcontext = ssl.create_default_context()context.load_cert_chain('cert.pem', 'key.pem') B
尝试使用 the SnapWrap library 时我遇到过这个错误: File "/usr/local/lib/python2.7/dist-packages/requests-2.7.0-p
我正在编写一个涉及 CAS、jspring 安全检查、重定向等的简单脚本。我想使用 Kenneth Reitz 的 python 请求,因为它很棒!但是,CAS 需要通过 SSL 进行验证,所以我必须
我有一个带有 letsencrypt 证书的 python3 django 网站 一切正常,除了使用 python 请求到本地地址: response = requests.post('http://
我正在编写一个涉及 CAS、jspring 安全检查、重定向等的简单脚本。我想使用 Kenneth Reitz 的 python 请求,因为它很棒!但是,CAS 需要通过 SSL 进行验证,所以我必须
尝试使用 Requests session 发出简单的获取请求,但我不断收到特定站点的 SSLerror。我认为问题可能出在网站上(我使用 https://www.ssllabs.com 进行了扫描,
我正在尝试通过 python 向 iPhone 发送推送通知,如 here 所述但我收到以下错误: Traceback (most recent call last): File "", line
我正在编写一个涉及 CAS、jspring 安全检查、重定向等的简单脚本。我想使用 Kenneth Reitz 的 python 请求,因为它是一项很棒的工作!但是,CAS 需要通过 SSL 进行验证
这是我检查链接的功能。但是当链接是假的时它会抛出一个错误。例如,它适用于 twitter.com 但不适用于 twitt.com。 class Quality_Check: def check
我正在分析加密货币市场数据并使用某些交易所的公共(public) API。该程序每隔几秒发出一次 HTTPS 请求。奇怪的是,它恰好发出了 336 个请求,而在 337 个请求上它总是失败: /.rb
我正在尝试开始使用 PRAW,但在使用 login() 时遇到问题。 我有以下代码: import praw r = praw.Reddit('This is a test bot') r.login
我想使用从服务器生成的证书从我的客户端向服务器进行身份验证。我有一个 server-ca.crt,下面是正在运行的 CURL 命令。如何使用 python 请求模块发送类似的请求。 $ curl -X
我正在使用带有以下代码的 authlib: session = OAuth2Session(client_id, client_secret) token = session.fetch_access
我想使用从服务器生成的证书从我的客户端向服务器进行身份验证。我有一个 server-ca.crt,下面是正在运行的 CURL 命令。如何使用 python 请求模块发送类似的请求。 $ curl -X
当我尝试执行“conda update conda”时,我遇到了这个错误: 请你帮帮我! 最佳答案 如果您在防火墙或代理后面,您可能必须在您的 condarc 中将 ssl_verify 设置为 fa
我有包含 4 行的 fiddle.py import requests url = "https://randomuser.me/api/" locations = requests.get(url,
我不能在 Python 中使用不同的代理。 我的代码: import requests proxies = { "https":'https://154.16.202.22:3128',
我是一名优秀的程序员,十分优秀!