-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
578f527
commit 33e24d2
Showing
12 changed files
with
1,157 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v2.3.0 | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
# Ruff version. | ||
rev: v0.7.4 | ||
hooks: | ||
- id: check-yaml | ||
- repo: https://github.com/psf/black | ||
rev: 22.10.0 | ||
hooks: | ||
- id: black | ||
# Run the linter. | ||
- id: ruff | ||
types_or: [python, pyi] | ||
args: [--fix] | ||
# Run the formatter. | ||
- id: ruff-format | ||
types_or: [python, pyi] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[project] | ||
name = "core-api" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
readme = "README.md" | ||
requires-python = ">=3.10" | ||
dependencies = [ | ||
"aiohttp==3.9.5", | ||
"asyncmy==0.2.8", | ||
"fastapi==0.100.1", | ||
"pandas>=2.0.3", | ||
"python-dotenv==1.0.0", | ||
"sqlalchemy==2.0.19", | ||
"starlette-prometheus==0.9.0", | ||
"uvicorn==0.23.1", | ||
] | ||
|
||
[dependency-groups] | ||
dev = [ | ||
"httpx>=0.28.0", | ||
"pytest-asyncio>=0.24.0", | ||
"pytest>=8.3.3", | ||
"ruff>=0.8.1", | ||
] |
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
from fastapi import APIRouter | ||
|
||
from src.api.legacy import legacy, legacy_debug | ||
from src.api.legacy import legacy | ||
|
||
router = APIRouter() | ||
|
||
router.include_router(legacy.router) | ||
router.include_router(legacy_debug.router) | ||
# router.include_router(legacy_debug.router) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import config, logging | ||
|
||
__all__ = ["logging", "config"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import json | ||
import logging | ||
|
||
|
||
# Configure JSON logging | ||
class JsonFormatter(logging.Formatter): | ||
def format(self, record): | ||
log_record = { | ||
"ts": self.formatTime(record, self.datefmt), | ||
"lvl": record.levelname, | ||
"name": record.name, | ||
# "module": record.module, | ||
"func": record.funcName, | ||
"line": record.lineno, | ||
"msg": record.getMessage(), | ||
} | ||
if record.exc_info: | ||
log_record["exception"] = self.formatException(record.exc_info) | ||
return json.dumps(log_record) | ||
|
||
|
||
class IgnoreSQLWarnings(logging.Filter): | ||
def filter(self, record): | ||
ignore_messages = ["Unknown table", "Duplicate entry"] | ||
# Check if any of the ignore messages are in the log record message | ||
if any(msg in record.getMessage() for msg in ignore_messages): | ||
return False # Don't log | ||
return True # Log | ||
|
||
|
||
# Set up the logger | ||
handler = logging.StreamHandler() | ||
handler.setFormatter(JsonFormatter()) | ||
|
||
logging.basicConfig(level=logging.INFO, handlers=[handler]) | ||
|
||
# set imported loggers to warning | ||
logging.getLogger("requests").setLevel(logging.DEBUG) | ||
logging.getLogger("urllib3").setLevel(logging.DEBUG) | ||
logging.getLogger("uvicorn").setLevel(logging.DEBUG) | ||
logging.getLogger("apscheduler").setLevel(logging.WARNING) | ||
logging.getLogger("aiomysql").setLevel(logging.ERROR) | ||
logging.getLogger("asyncmy").setLevel(logging.ERROR) | ||
logging.getLogger("aiokafka").setLevel(logging.WARNING) |
Oops, something went wrong.