feat: add Didox service integration for company info retrieval
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 2m9s
All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 2m9s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from .otp import * # noqa
|
||||
from .sms import * # noqa
|
||||
from .user import * # noqa
|
||||
from .didox import * # noqa
|
||||
27
core/services/didox.py
Normal file
27
core/services/didox.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import requests
|
||||
from django.conf import settings
|
||||
import logging
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DidoxService:
|
||||
BASE_URL = "https://testapi3.didox.uz/v1"
|
||||
|
||||
@classmethod
|
||||
def get_company_info(cls, tin: int) -> dict:
|
||||
url = f"{cls.BASE_URL}/utils/info/{tin}"
|
||||
|
||||
headers = {"Partner-Authorization": settings.DIDOX_PARTNER_TOKEN}
|
||||
|
||||
try:
|
||||
response = requests.get(url=url, headers=headers, timeout=15,verify=False)
|
||||
|
||||
response.raise_for_status()
|
||||
|
||||
return response.json()
|
||||
|
||||
except requests.RequestException as e:
|
||||
logger.exception(f"Didox API error: {str(e)}")
|
||||
return {}
|
||||
Reference in New Issue
Block a user