mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-06 00:01:05 +00:00
chore: add python-dotenv dependency and update imports
This commit is contained in:
1 parent
b5dcdcbdfb
commit
f3bb60ca89
3 files changed
+18
-2
No files matched your search
+6
-2
@@ -18,6 +18,7 @@ import sys
|
||||
from contextlib import asynccontextmanager
|
||||
from pathlib import Path
|
||||
|
||||
from dotenv import load_dotenv
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import JSONResponse
|
||||
@@ -29,6 +30,9 @@ from app.platform.errors import AppError
|
||||
from app.platform.meta import get_project_version
|
||||
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Scheduler leader-election via advisory file lock
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -54,7 +58,7 @@ def _try_acquire_scheduler_lock() -> bool:
|
||||
except BlockingIOError:
|
||||
# Another worker already holds the lock.
|
||||
return False
|
||||
except (OSError, AttributeError):
|
||||
except (ImportError, OSError, AttributeError):
|
||||
# fcntl unavailable (Windows) or unexpected FS error — treat as leader.
|
||||
return True
|
||||
|
||||
@@ -67,7 +71,7 @@ def _release_scheduler_lock() -> None:
|
||||
import fcntl
|
||||
fcntl.flock(_lock_fd, fcntl.LOCK_UN)
|
||||
os.close(_lock_fd)
|
||||
except OSError:
|
||||
except (ImportError, OSError):
|
||||
pass
|
||||
_lock_fd = None
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ dependencies = [
|
||||
"loguru>=0.7.3",
|
||||
"orjson>=3.11.4",
|
||||
"pydantic>=2.12.3",
|
||||
"python-dotenv>=1.1.1",
|
||||
"python-multipart>=0.0.21",
|
||||
"redis>=6.4.0",
|
||||
"sqlalchemy>=2.0.46",
|
||||
|
||||
@@ -541,6 +541,7 @@ dependencies = [
|
||||
{ name = "loguru" },
|
||||
{ name = "orjson" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "python-multipart" },
|
||||
{ name = "redis" },
|
||||
{ name = "sqlalchemy" },
|
||||
@@ -567,6 +568,7 @@ requires-dist = [
|
||||
{ name = "loguru", specifier = ">=0.7.3" },
|
||||
{ name = "orjson", specifier = ">=3.11.4" },
|
||||
{ name = "pydantic", specifier = ">=2.12.3" },
|
||||
{ name = "python-dotenv", specifier = ">=1.1.1" },
|
||||
{ name = "python-multipart", specifier = ">=0.0.21" },
|
||||
{ name = "redis", specifier = ">=6.4.0" },
|
||||
{ name = "sqlalchemy", specifier = ">=2.0.46" },
|
||||
@@ -904,6 +906,15 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/7c/4c/ad33b92b9864cbde84f259d5df035a6447f91891f5be77788e2a3892bce3/pymysql-1.1.2-py3-none-any.whl", hash = "sha256:e6b1d89711dd51f8f74b1631fe08f039e7d76cf67a42a323d3178f0f25762ed9", size = 45300, upload-time = "2025-08-24T12:55:53.394Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dotenv"
|
||||
version = "1.2.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/82/ed/0301aeeac3e5353ef3d94b6ec08bbcabd04a72018415dcb29e588514bba8/python_dotenv-1.2.2.tar.gz", hash = "sha256:2c371a91fbd7ba082c2c1dc1f8bf89ca22564a087c2c287cd9b662adde799cf3", size = 50135, upload-time = "2026-03-01T16:00:26.196Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0b/d7/1959b9648791274998a9c3526f6d0ec8fd2233e4d4acce81bbae76b44b2a/python_dotenv-1.2.2-py3-none-any.whl", hash = "sha256:1d8214789a24de455a8b8bd8ae6fe3c6b69a5e3d64aa8a8e5d68e694bbcb285a", size = 22101, upload-time = "2026-03-01T16:00:25.09Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-multipart"
|
||||
version = "0.0.22"
|
||||
|
||||
Reference in new issue
Block a user