Hawk Python Catcher
===========
Python errors Catcher module for [Hawk.so](https://hawk.so).
Usage
-----
Register an account and get a new project token.
### Install module
Install `hawkcatcher` from PyPI.
```shell
$ pip install hawkcatcher
```
Import Catcher module to your project.
```python
from hawkcatcher import Hawk
```
Then enable Hawk Catcher with your token and domain.
```python
hawk = Hawk(
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9qZWN0SWQiOiI1ZTZmNWM3NzAzOWI0MDAwMjNmZDViODAiLCJpYXQiOjE1ODQzNTY0NzF9.t-5Gelx3MgHVBrxTsoMyPQAdQ6ufVbPsts9zZLW3gM8")
```
Now all global errors would be sent to Hawk.
### Try-except
If you want to catch errors in try-except blocks then use `hawk.catch()` in except:
```python
try:
...
except:
hawk.send()
```
### Manual sending
You can also pass event to the `hawk.send()` call, for example:
```python
try:
...
except:
hawk.send(ValueError("error description"))
```
### Event context
It is possible to pass additional event context for debugging purposes:
```python
try:
...
except:
hawk.send(ValueError("error description"), {"params": "value"})
```
### Affected user
You can also pass user, who affected with specific error:
```python
try:
...
except:
hawk.send(ValueError("error description"), {"params": "value"}, {"id": 123})
```
Init params
-----------
To init Hawk Catcher just pass a project token.
```python
hawk = Hawk('1234567-abcd-8901-efgh-123456789012')
```
### Additional params
If you need to use custom Hawk server then pass a dictionary with params.
```python
hawk = Hawk({
'token': '1234567-abcd-8901-efgh-123456789012',
'collector_endpoint': 'https://<id>.k1.hawk.so',
})
```
Requirements
------------
- Python \>= 3.5
- requests
Links
-----
Repository: <https://github.com/codex-team/hawk.python>
Report a bug: <https://github.com/codex-team/hawk.python/issues>
PyPI Package: <https://pypi.python.org/pypi/hawkcatcher>
CodeX Team: <https://ifmo.su>
Raw data
{
"_id": null,
"home_page": "https://github.com/codex-team/deployserver",
"name": "hawkcatcher",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.5",
"maintainer_email": "",
"keywords": "catcher hawk codex bug errors tracker",
"author": "CodeX Team",
"author_email": "team@ifmo.su",
"download_url": "https://files.pythonhosted.org/packages/3a/63/955b3a27ba8cc2e3e49225a5a6549a581e78eea395e7228a68d9f47c8d72/hawkcatcher-3.4.1.tar.gz",
"platform": null,
"description": "Hawk Python Catcher\n===========\n\nPython errors Catcher module for [Hawk.so](https://hawk.so).\n\nUsage\n-----\n\nRegister an account and get a new project token.\n\n### Install module\n\nInstall `hawkcatcher` from PyPI.\n\n```shell\n$ pip install hawkcatcher\n```\n\nImport Catcher module to your project.\n\n```python\nfrom hawkcatcher import Hawk\n```\n\nThen enable Hawk Catcher with your token and domain.\n\n```python\nhawk = Hawk(\n \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJwcm9qZWN0SWQiOiI1ZTZmNWM3NzAzOWI0MDAwMjNmZDViODAiLCJpYXQiOjE1ODQzNTY0NzF9.t-5Gelx3MgHVBrxTsoMyPQAdQ6ufVbPsts9zZLW3gM8\")\n```\n\nNow all global errors would be sent to Hawk.\n\n### Try-except\n\nIf you want to catch errors in try-except blocks then use `hawk.catch()` in except:\n\n```python\ntry:\n ...\nexcept:\n hawk.send()\n```\n\n### Manual sending\n\nYou can also pass event to the `hawk.send()` call, for example:\n\n```python\ntry:\n ...\nexcept:\n hawk.send(ValueError(\"error description\"))\n```\n\n\n### Event context\n\nIt is possible to pass additional event context for debugging purposes:\n\n```python\ntry:\n ...\nexcept:\n hawk.send(ValueError(\"error description\"), {\"params\": \"value\"})\n```\n\n### Affected user\n\nYou can also pass user, who affected with specific error:\n\n```python\ntry:\n ...\nexcept:\n hawk.send(ValueError(\"error description\"), {\"params\": \"value\"}, {\"id\": 123})\n```\n\nInit params\n-----------\n\nTo init Hawk Catcher just pass a project token.\n\n```python\nhawk = Hawk('1234567-abcd-8901-efgh-123456789012')\n```\n\n### Additional params\n\nIf you need to use custom Hawk server then pass a dictionary with params.\n\n```python\nhawk = Hawk({\n 'token': '1234567-abcd-8901-efgh-123456789012',\n 'collector_endpoint': 'https://<id>.k1.hawk.so',\n})\n```\n\nRequirements\n------------\n\n- Python \\>= 3.5\n- requests\n\nLinks\n-----\n\nRepository: <https://github.com/codex-team/hawk.python>\n\nReport a bug: <https://github.com/codex-team/hawk.python/issues>\n\nPyPI Package: <https://pypi.python.org/pypi/hawkcatcher>\n\nCodeX Team: <https://ifmo.su>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python errors Catcher module for Hawk.",
"version": "3.4.1",
"split_keywords": [
"catcher",
"hawk",
"codex",
"bug",
"errors",
"tracker"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "924946bcd9cf59607d8c9b8cd10323fbfd4d8501a9bd44ba7756169c95e823a2",
"md5": "8a7bb6b4babfb38d2b474da806e93d89",
"sha256": "bf99dd877c17518dfd63de5e4a14ea0c77188e3dcf256f985b770b74db1744c3"
},
"downloads": -1,
"filename": "hawkcatcher-3.4.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8a7bb6b4babfb38d2b474da806e93d89",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.5",
"size": 9127,
"upload_time": "2023-03-17T10:19:05",
"upload_time_iso_8601": "2023-03-17T10:19:05.571017Z",
"url": "https://files.pythonhosted.org/packages/92/49/46bcd9cf59607d8c9b8cd10323fbfd4d8501a9bd44ba7756169c95e823a2/hawkcatcher-3.4.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3a63955b3a27ba8cc2e3e49225a5a6549a581e78eea395e7228a68d9f47c8d72",
"md5": "7fe7fd38c5e6b6d3c8cc7be9cc7a1e0e",
"sha256": "afa083cf860145acba7ab4ff1ad899ae7b934bd954d28fb01b6f786dc56a8acc"
},
"downloads": -1,
"filename": "hawkcatcher-3.4.1.tar.gz",
"has_sig": false,
"md5_digest": "7fe7fd38c5e6b6d3c8cc7be9cc7a1e0e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.5",
"size": 7551,
"upload_time": "2023-03-17T10:19:07",
"upload_time_iso_8601": "2023-03-17T10:19:07.132317Z",
"url": "https://files.pythonhosted.org/packages/3a/63/955b3a27ba8cc2e3e49225a5a6549a581e78eea395e7228a68d9f47c8d72/hawkcatcher-3.4.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-17 10:19:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "codex-team",
"github_project": "deployserver",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "hawkcatcher"
}