Hawk Python Catcher
Python errors Catcher module for Hawk.so.
Usage
Register an account and get a new project token.
If you want to connect specific frameworks see Flask integration, FastAPI integration.
Install module
Install hawk-python-sdk from PyPI.
$ pip install hawk-python-sdk
Import Catcher module to your project.
from hawk_python_sdk import Hawk
from hawk_python_sdk 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',
})
Parameters:
| name | type | required | description |
|---|---|---|---|
token |
str | required | Your project's Integration Token |
release |
str | optional | Release name for Suspected Commits feature |
collector_endpoint |
string | optional | Collector endpoint for sending event to |
context |
dict | optional | Additional context to be send with every event |
before_send |
Callable[[dict], None] | optional | This Method allows you to filter any data you don't want sending to Hawk |
Requirements
- Python >= 3.10
- 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/hawk-python-sdk
CodeX Team: https://codex.so/
Metadata
Release files for hawk-python-sdk 3.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hawk_python_sdk-3.5.2.tar.gz | 12.5 kB | Without provenance | Details for hawk_python_sdk-3.5.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hawk_python_sdk-3.5.2-py3-none-any.whl | Python 3 | none | any | Details for hawk_python_sdk-3.5.2-py3-none-any.whl |
Total release size: 23.4 kB
Release files / hawk_python_sdk-3.5.2.tar.gz
| Download URL | hawk_python_sdk-3.5.2.tar.gz |
|---|---|
| Size | 12.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a1d3a071afef31ae0ac4383cd0cee9849fff97b49eb9902207fd92643bb9469
|
|
BLAKE2b-256 checksum How to use checksums |
647256ccabe737913cdd274cafe3d9b15975b3e3c7e728dc6a88b43711fd5133
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.4
|
Release files / hawk_python_sdk-3.5.2-py3-none-any.whl
| Download URL | hawk_python_sdk-3.5.2-py3-none-any.whl |
|---|---|
| Size | 10.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7e9c2b3ddc764aaf76254f6d0038b855bf3f5f3fcb7e136f0d544168c9a5b9d
|
|
BLAKE2b-256 checksum How to use checksums |
457c605460fef255a6df8e9f6523ae49cfaf4272285ec2acdb6c52e472b7fd4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.11.4
|
Security for hawk-python-sdk 3.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.