haikal/inventory/utils.py
2024-12-08 14:07:50 +03:00

32 lines
771 B
Python

import requests
from django.utils.translation import gettext_lazy as _
def get_jwt_token():
url = 'https://carapi.app/api/auth/login'
headers = {
'accept': 'text/plain',
'Content-Type': 'application/json',
}
data = {
"api_token": "f5204a00-6f31-4de2-96d8-ed998e0d230c",
"api_secret": "8c11320781a5b8f4f327b6937e6f8241"
}
try:
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
return response.text
except requests.exceptions.RequestException as e:
print(f"Error obtaining JWT token: {e}")
return None
def localize_some_words():
success = _('success')
error = _('error')
forget = _('Forgot Password?')
return None