Add NHN Cloud API integration with async task support
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
- NHN Cloud API packages: token, vpc, compute, nks, storage - REST API endpoints with Swagger documentation - Async task processing for long-running operations - CORS configuration for frontend integration - Enhanced logging for debugging API calls Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
31
nhn/utils.py
Normal file
31
nhn/utils.py
Normal file
@ -0,0 +1,31 @@
|
||||
import requests
|
||||
from django.conf import settings
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def verify_token_with_auth_server(token: str):
|
||||
"""
|
||||
Verify token with external auth server.
|
||||
"""
|
||||
url = settings.AUTH_VERIFY_URL
|
||||
if not url:
|
||||
logger.warning("AUTH_VERIFY_URL is not configured.")
|
||||
return None
|
||||
|
||||
try:
|
||||
response = requests.post(
|
||||
url,
|
||||
json={"token": token},
|
||||
headers={"Content-Type": "application/json"},
|
||||
timeout=5,
|
||||
)
|
||||
if response.status_code == 200:
|
||||
return response.json()
|
||||
else:
|
||||
logger.error(f"Auth server returned status {response.status_code}")
|
||||
return None
|
||||
except requests.RequestException as e:
|
||||
logger.error(f"Failed to verify token: {e}")
|
||||
return None
|
||||
Reference in New Issue
Block a user