diff --git a/README.md b/README.md index 9753256..1bcbda0 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,16 @@ If you want to connect specific frameworks see [Flask integration](./docs/flask. ### Install module -Install `hawk-catcher` from PyPI. +Install `hawk-python-sdk` from PyPI. ```shell -$ pip install hawk-catcher +$ pip install hawk-python-sdk ``` Import Catcher module to your project. ```python -from hawk_catcher import Hawk +from hawk_python_sdk import Hawk ``` Then enable Hawk Catcher with your token and domain. @@ -115,6 +115,6 @@ Repository: Report a bug: -PyPI Package: +PyPI Package: CodeX Team: diff --git a/docs/fastapi.md b/docs/fastapi.md index b38d11f..2184fcd 100644 --- a/docs/fastapi.md +++ b/docs/fastapi.md @@ -5,13 +5,13 @@ This extension adds support for the [FastAPI](https://fastapi.tiangolo.com/) web ## Installation ```bash -pip install hawk-catcher[fastapi] +pip install hawk-python-sdk[fastapi] ``` import Catcher module to your project. ```python -from hawk_catcher.modules.fastapi import HawkFastapi +from hawk_python_sdk.modules.fastapi import HawkFastapi ``` ```python diff --git a/docs/flask.md b/docs/flask.md index ce2e890..581e19d 100644 --- a/docs/flask.md +++ b/docs/flask.md @@ -5,13 +5,13 @@ This extension adds support for the [Flask](http://flask.pocoo.org/) web framewo ## Installation ```bash -pip install hawk-catcher[flask] +pip install hawk-python-sdk[flask] ``` import Catcher module to your project. ```python -from hawk_catcher.modules.flask import HawkFlask +from hawk_python_sdk.modules.flask import HawkFlask ``` ```python diff --git a/example/example.py b/example/example.py index b83802f..9aebd9d 100644 --- a/example/example.py +++ b/example/example.py @@ -1,5 +1,5 @@ import os -from hawk_catcher import Hawk +from hawk_python_sdk import Hawk from dotenv import load_dotenv load_dotenv() # take environment variables from .env. diff --git a/example/example2.py b/example/example2.py index e230795..b581d5a 100644 --- a/example/example2.py +++ b/example/example2.py @@ -1,4 +1,4 @@ -import hawk_catcher +import hawk_python_sdk import os from dotenv import load_dotenv @@ -18,13 +18,13 @@ def test_method(self): self.divide_by_zero() def mannual_sending(self): - hawk_catcher.send(ValueError("lol"), {"ping": "pong", "number": 1}) + hawk_python_sdk.send(ValueError("lol"), {"ping": "pong", "number": 1}) def send_custom_error(self): raise InvalidToken() def send_with_user(self): - hawk_catcher.send( + hawk_python_sdk.send( ValueError("USER"), None, {'id': 1, 'name': 'Alice'} @@ -35,9 +35,9 @@ def main(): token = os.getenv('HAWK_TOKEN') if token is None or token == "": - print('hawk-catcher token not provided. Please provide HAWK_TOKEN variable in .env file') + print('hawk-python-sdk token not provided. Please provide HAWK_TOKEN variable in .env file') return - hawk_catcher.init(token) + hawk_python_sdk.init(token) test = Module() test.mannual_sending() test.send_with_user() diff --git a/example/fill_events.py b/example/fill_events.py index 417dfe2..33c4147 100644 --- a/example/fill_events.py +++ b/example/fill_events.py @@ -1,6 +1,6 @@ import random import os -import hawk_catcher +import hawk_python_sdk from faker import Faker fake = Faker() @@ -48,7 +48,7 @@ def random_exception(): ] token = os.getenv('HAWK_TOKEN') -hawk_catcher.init(token) +hawk_python_sdk.init(token) for _ in range(10): try: @@ -57,7 +57,7 @@ def random_exception(): except Exception as e: random_username = fake.user_name() random_email = fake.email() - hawk_catcher.send(e, {'username': random_username, 'value': random_email}) + hawk_python_sdk.send(e, {'username': random_username, 'value': random_email}) for _ in range(2): try: @@ -65,4 +65,4 @@ def random_exception(): except Exception as e: random_username = fake.user_name() random_email = fake.email() - hawk_catcher.send(e, {'username': random_username, 'value': random_email}) \ No newline at end of file + hawk_python_sdk.send(e, {'username': random_username, 'value': random_email}) \ No newline at end of file diff --git a/example/requirements.txt b/example/requirements.txt index a13faa6..142da53 100644 --- a/example/requirements.txt +++ b/example/requirements.txt @@ -1,2 +1,2 @@ -hawk-catcher +hawk-python-sdk faker \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ab71662..0ba254a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] dynamic = ["version"] dependencies = ["requests"] -name = "hawk-catcher" +name = "hawk-python-sdk" authors = [{ name = "CodeX Team", email = "team@codex.so" }] description = "Python errors Catcher module for Hawk." readme = "README.md" @@ -21,7 +21,7 @@ classifiers = [ flask = ["flask"] fastapi = ["starlette"] [tool.hatch.version] -path = "src/hawk_catcher/__init__.py" +path = "src/hawk_python_sdk/__init__.py" [project.urls] Homepage = "https://github.com/codex-team/hawk.python" Issues = "https://github.com/codex-team/hawk.python/issues" diff --git a/src/hawk_catcher/__init__.py b/src/hawk_python_sdk/__init__.py similarity index 100% rename from src/hawk_catcher/__init__.py rename to src/hawk_python_sdk/__init__.py diff --git a/src/hawk_catcher/core.py b/src/hawk_python_sdk/core.py similarity index 94% rename from src/hawk_catcher/core.py rename to src/hawk_python_sdk/core.py index 02c48b4..28d5f54 100644 --- a/src/hawk_catcher/core.py +++ b/src/hawk_python_sdk/core.py @@ -7,9 +7,9 @@ from base64 import b64decode import json -import hawk_catcher -from hawk_catcher.errors import InvalidHawkToken -from hawk_catcher.types import HawkCatcherSettings, Addons, User +import hawk_python_sdk +from hawk_python_sdk.errors import InvalidHawkToken +from hawk_python_sdk.types import HawkCatcherSettings, Addons, User class Hawk: @@ -89,7 +89,7 @@ def handler(self, exc_cls: type, exc: Exception, tb: traceback, context=None, us 'backtrace': backtrace, 'release': self.params['release'], 'context': context, - 'catcherVersion': hawk_catcher.__version__, + 'catcherVersion': hawk_python_sdk.__version__, 'user': user, 'addons': addons } diff --git a/src/hawk_catcher/errors.py b/src/hawk_python_sdk/errors.py similarity index 100% rename from src/hawk_catcher/errors.py rename to src/hawk_python_sdk/errors.py diff --git a/src/hawk_catcher/modules/fastapi/__init__.py b/src/hawk_python_sdk/modules/fastapi/__init__.py similarity index 100% rename from src/hawk_catcher/modules/fastapi/__init__.py rename to src/hawk_python_sdk/modules/fastapi/__init__.py diff --git a/src/hawk_catcher/modules/fastapi/fastapi.py b/src/hawk_python_sdk/modules/fastapi/fastapi.py similarity index 94% rename from src/hawk_catcher/modules/fastapi/fastapi.py rename to src/hawk_python_sdk/modules/fastapi/fastapi.py index 7084e03..eebaca8 100644 --- a/src/hawk_catcher/modules/fastapi/fastapi.py +++ b/src/hawk_python_sdk/modules/fastapi/fastapi.py @@ -1,11 +1,11 @@ -from hawk_catcher.types import HawkCatcherSettings +from hawk_python_sdk.types import HawkCatcherSettings from ...core import Hawk -from hawk_catcher.modules.fastapi.types import FastapiSettings, FastapiAddons +from hawk_python_sdk.modules.fastapi.types import FastapiSettings, FastapiAddons from starlette.types import ASGIApp, Receive, Scope, Send from starlette.requests import Request from starlette.middleware.base import BaseHTTPMiddleware from typing import Union -from hawk_catcher.errors import ModuleError +from hawk_python_sdk.errors import ModuleError import asyncio from contextvars import ContextVar from fastapi import Request diff --git a/src/hawk_catcher/modules/fastapi/types.py b/src/hawk_python_sdk/modules/fastapi/types.py similarity index 89% rename from src/hawk_catcher/modules/fastapi/types.py rename to src/hawk_python_sdk/modules/fastapi/types.py index 1fab3aa..77fd733 100644 --- a/src/hawk_catcher/modules/fastapi/types.py +++ b/src/hawk_python_sdk/modules/fastapi/types.py @@ -1,4 +1,4 @@ -from hawk_catcher.types import HawkCatcherSettings, User, Addons +from hawk_python_sdk.types import HawkCatcherSettings, User, Addons from typing import Callable, TypedDict from starlette.applications import Starlette from fastapi import Request diff --git a/src/hawk_catcher/modules/flask/__init__.py b/src/hawk_python_sdk/modules/flask/__init__.py similarity index 100% rename from src/hawk_catcher/modules/flask/__init__.py rename to src/hawk_python_sdk/modules/flask/__init__.py diff --git a/src/hawk_catcher/modules/flask/flask.py b/src/hawk_python_sdk/modules/flask/flask.py similarity index 95% rename from src/hawk_catcher/modules/flask/flask.py rename to src/hawk_python_sdk/modules/flask/flask.py index e0b1ee2..23394a7 100644 --- a/src/hawk_catcher/modules/flask/flask.py +++ b/src/hawk_python_sdk/modules/flask/flask.py @@ -1,7 +1,7 @@ from ...core import Hawk from typing import Union -from hawk_catcher.modules.flask.types import FlaskSettings, Addons -from hawk_catcher.errors import ModuleError +from hawk_python_sdk.modules.flask.types import FlaskSettings, Addons +from hawk_python_sdk.errors import ModuleError try: from flask.signals import got_request_exception diff --git a/src/hawk_catcher/modules/flask/types.py b/src/hawk_python_sdk/modules/flask/types.py similarity index 88% rename from src/hawk_catcher/modules/flask/types.py rename to src/hawk_python_sdk/modules/flask/types.py index 93e93fd..c588697 100644 --- a/src/hawk_catcher/modules/flask/types.py +++ b/src/hawk_python_sdk/modules/flask/types.py @@ -1,4 +1,4 @@ -from hawk_catcher.types import HawkCatcherSettings, User, Addons +from hawk_python_sdk.types import HawkCatcherSettings, User, Addons from typing import Callable, TypedDict from flask import Request diff --git a/src/hawk_catcher/types.py b/src/hawk_python_sdk/types.py similarity index 100% rename from src/hawk_catcher/types.py rename to src/hawk_python_sdk/types.py diff --git a/tests/test_cather.py b/tests/test_cather.py index ddc9d70..d0b6d2b 100644 --- a/tests/test_cather.py +++ b/tests/test_cather.py @@ -2,9 +2,9 @@ import pytest -from hawk_catcher import __version__ -from hawk_catcher import Hawk -from hawk_catcher.errors import InvalidHawkToken +from hawk_python_sdk import __version__ +from hawk_python_sdk import Hawk +from hawk_python_sdk.errors import InvalidHawkToken sample_token = "eyJpbnRlZ3JhdGlvbklkIjoiZGRjZmY4OTItODMzMy00YjVlLWIyYWQtZWM1MDQ5MDVjMjFlIiwic2VjcmV0IjoiZmJjYzIwMTEtMTY5My00NDIyLThiNDItZDRlMzdlYmI4NWIwIn0=" sample_token_collector_endpoint = "https://ddcff892-8333-4b5e-b2ad-ec504905c21e.k1.hawk.so"