All checks were successful
Deploy to Production / build-and-deploy (push) Successful in 2m9s
28 lines
669 B
Python
28 lines
669 B
Python
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 {}
|