Python errors Catcher module for Hawk.
Project description
Hawk Python Catcher
Python errors Catcher module for Hawk.so.
Usage
Register an account and get a new project token.
Install module
Install hawkcatcher
from PyPI.
$ pip install hawkcatcher
Import Catcher module to your project.
from hawkcatcher import Hawk
Then enable Hawk Catcher with your token and domain.
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:
try:
...
except:
hawk.send()
Manual sending
You can also pass event to the hawk.send()
call, for example:
try:
...
except:
hawk.send(ValueError("error description"))
Event context
It is possible to pass additional event context for debugging purposes:
try:
...
except:
hawk.send(ValueError("error description"), {"params": "value"})
Affected user
You can also pass user, who affected with specific error:
try:
...
except:
hawk.send(ValueError("error description"), {"params": "value"}, {"id": 123})
Init params
To init Hawk Catcher just pass a project token.
hawk = Hawk('1234567-abcd-8901-efgh-123456789012')
Additional params
If you need to use custom Hawk server then pass a dictionary with params.
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for hawkcatcher-3.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b71dbc8f9587d44569b7fd338fc8089aa898e97dddd89eb3f9c0a79178b09f55 |
|
MD5 | 8bff5c6886d4a1bc7039e2e5430720a2 |
|
BLAKE2b-256 | 53deb3f96c99a3a4d9e206b3cfe3f207595da45fd201fc94464853fc20c7f202 |