Skip to content

Commit d499d42

Browse files
add api key validator
1 parent 1bb4dca commit d499d42

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "oxylabs-ai-studio"
3-
version = "0.2.8"
3+
version = "0.2.9"
44
description = "Oxylabs studio python sdk"
55
readme = "README.md"
66
keywords = ["oxylabs", "ai", "studio"]

src/oxylabs_ai_studio/utils.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import httpx
2+
3+
from oxylabs_ai_studio.logger import get_logger
4+
from oxylabs_ai_studio.settings import settings
5+
6+
logger = get_logger(__name__)
7+
8+
9+
def is_api_key_valid(api_key: str) -> bool:
10+
try:
11+
response = httpx.get(
12+
f"{settings.OXYLABS_AI_STUDIO_API_URL}/status",
13+
headers={"x-api-key": api_key},
14+
)
15+
return response.status_code == 200
16+
except Exception:
17+
logger.exception("Error checking API key")
18+
return False

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)