Skip to main content

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hawkcatcher-3.4.1.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hawkcatcher-3.4.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file hawkcatcher-3.4.1.tar.gz.

File metadata

  • Download URL: hawkcatcher-3.4.1.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for hawkcatcher-3.4.1.tar.gz
Algorithm Hash digest
SHA256 afa083cf860145acba7ab4ff1ad899ae7b934bd954d28fb01b6f786dc56a8acc
MD5 7fe7fd38c5e6b6d3c8cc7be9cc7a1e0e
BLAKE2b-256 3a63955b3a27ba8cc2e3e49225a5a6549a581e78eea395e7228a68d9f47c8d72

See more details on using hashes here.

File details

Details for the file hawkcatcher-3.4.1-py3-none-any.whl.

File metadata

  • Download URL: hawkcatcher-3.4.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for hawkcatcher-3.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf99dd877c17518dfd63de5e4a14ea0c77188e3dcf256f985b770b74db1744c3
MD5 8a7bb6b4babfb38d2b474da806e93d89
BLAKE2b-256 924946bcd9cf59607d8c9b8cd10323fbfd4d8501a9bd44ba7756169c95e823a2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.4.1 This release

2 files

3.4.0

2 files

3.3.0

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

2.0.0

3 files

1.1.2

1 file

1.1.1

1 file

1.1.0

1 file

1.0.1

1 file

1.0.0

1 file

0.2.2

1 file

0.2.1

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page