123456 |
- {
- "html": "<div class=\"section\" id=\"installation\">\n<h2>Installation</h2>\n<p>If you haven’t already, start by downloading Raven. The easiest way is\nwith <em>pip</em>:</p>\n<div class=\"highlight-python\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span>pip install raven --upgrade\n</pre></div>\n</div>\n</div>\n\n\n<div class=\"section\" id=\"capture-an-error\">\n<h2>Capture an Error</h2>\n<p>The most basic use for raven is to record one specific error that occurs:</p>\n<div class=\"highlight-python\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #2eb0f7\">from</span> <span style=\"color: #111111\">raven</span> <span style=\"color: #2eb0f7\">import</span> <span style=\"color: #111111\">Client</span>\n\n<span style=\"color: #111111\">client</span> <span style=\"color: #4b4f5c\">=</span> <span style=\"color: #111111\">Client(</span><span style=\"color: #e8535a\">'___DSN___'</span><span style=\"color: #111111\">)</span>\n\n<span style=\"color: #2eb0f7\">try</span><span style=\"color: #111111\">:</span>\n <span style=\"color: #45c2c9\">1</span> <span style=\"color: #4b4f5c\">/</span> <span style=\"color: #45c2c9\">0</span>\n<span style=\"color: #2eb0f7\">except</span> <span style=\"color: #e8535a\">ZeroDivisionError</span><span style=\"color: #111111\">:</span>\n <span style=\"color: #111111\">client</span><span style=\"color: #4b4f5c\">.</span><span style=\"color: #111111\">captureException()</span>\n</pre></div>\n</div>\n</div>\n\n\n<div class=\"section\" id=\"reporting-an-event\">\n<h2>Reporting an Event</h2>\n<p>To report an arbitrary event you can use the\n<a class=\"reference internal\" href=\"https://docs.getsentry.com/clients/python/api/#raven.Client.capture\" title=\"raven.Client.capture\"><code class=\"xref py py-meth docutils literal\"><span class=\"pre\">capture()</span></code></a> method. This is the most low-level\nmethod available. In most cases you would want to use the\n<a class=\"reference internal\" href=\"https://docs.getsentry.com/clients/python/api/#raven.Client.captureMessage\" title=\"raven.Client.captureMessage\"><code class=\"xref py py-meth docutils literal\"><span class=\"pre\">captureMessage()</span></code></a> method instead however which\ndirectly reports a message:</p>\n<div class=\"highlight-python\"><div class=\"highlight\" style=\"background: #ffffff\"><pre style=\"line-height: 125%\"><span></span><span style=\"color: #111111\">client</span><span style=\"color: #4b4f5c\">.</span><span style=\"color: #111111\">captureMessage(</span><span style=\"color: #e8535a\">'Something went fundamentally wrong'</span><span style=\"color: #111111\">)</span>\n</pre></div>\n</div>\n</div>\n",
- "link": "https://docs.getsentry.com/clients/python/",
- "id": "python",
- "name": "Python"
- }
|