nati-log 2.1.4__py3-none-any.whl → 2.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
nati_log/client.py CHANGED
@@ -17,7 +17,8 @@ class NatiLogClient:
17
17
  try:
18
18
  response = requests.post(self.api_url_login, json=payload, timeout=10)
19
19
  response.raise_for_status() # Lanza un error si el código de estado no es 200
20
- self.token = response.json().get("access")
20
+ data = response.json()
21
+ self.token = data.get("access") or data.get("token")
21
22
  except requests.exceptions.RequestException as e:
22
23
  self.token = None
23
24
 
nati_log/middleware.py CHANGED
@@ -9,28 +9,16 @@ class NatiLogMiddleware:
9
9
  self.get_response = get_response
10
10
  print(f"NATILOG_API_URL: {getattr(settings, 'NATILOG_API_URL', None)}")
11
11
  print(f"NATILOG_USERNAME: {getattr(settings, 'NATILOG_USERNAME', None)}")
12
-
13
- # Obtener parámetros desde settings
14
- self.api_url = getattr(settings, "NATILOG_API_URL", None)
15
- self.api_url_login = getattr(settings, "NATILOG_API_URL_LOGIN", None)
16
- self.app_id = getattr(settings, "NATILOG_APP_ID", None)
17
- self.username = getattr(settings, "NATILOG_USERNAME", None)
18
- self.password = getattr(settings, "NATILOG_PASSWORD", None)
19
-
20
- # Inicializar el cliente con manejo de errores
21
- try:
22
- self.natilog = NatiLogClient(
23
- api_url=self.api_url,
24
- api_url_login=self.api_url_login,
25
- app_id=self.app_id,
26
- username=self.username,
27
- password=self.password,
28
- )
29
- print("NatiLogClient inicializado correctamente.")
30
- except Exception as e:
31
- print(f"Error al inicializar NatiLogClient: {e}")
32
- self.natilog = None
33
-
12
+
13
+ self.natilog = NatiLogClient(
14
+ api_url=getattr(settings, "NATILOG_API_URL"),
15
+ api_url_login=getattr(settings, "NATILOG_API_URL_LOGIN"),
16
+ app_id=getattr(settings, "NATILOG_APP_ID"),
17
+ username=getattr(settings, "NATILOG_USERNAME"),
18
+ password=getattr(settings, "NATILOG_PASSWORD"),
19
+ )
20
+ print("NatiLogClient inicializado correctamente.")
21
+
34
22
  def __call__(self, request):
35
23
  """
36
24
  Procesa la solicitud y registra eventos en NatiLog.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: nati-log
3
- Version: 2.1.4
3
+ Version: 2.1.6
4
4
  Summary: Librería para interactuar con la API de NatiLog
5
5
  Home-page: UNKNOWN
6
6
  Author: Natalí
@@ -0,0 +1,7 @@
1
+ nati_log/__init__.py,sha256=hk7FdUPg_4nqaXVqpJLwPqrRpwiw78q1cTN46MZXTsU,33
2
+ nati_log/client.py,sha256=cAWAzcBY5qUC62YC5J7Fvnd9Pu1EGMeLuHC5gd9gHZ8,3371
3
+ nati_log/middleware.py,sha256=y9B2y9HxXm_EBPxfAyTX1kLSQmkfyE4Jnn7hwWMW7Ks,2472
4
+ nati_log-2.1.6.dist-info/METADATA,sha256=r7IuaAKBoAG70XUwU1Tn3fNahgNsfd7Ch_X6uFbFFmI,245
5
+ nati_log-2.1.6.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
6
+ nati_log-2.1.6.dist-info/top_level.txt,sha256=lgrIlHI78ZiRKmSnTdwr5dh9AyCDexp2JRGAbcl4lss,9
7
+ nati_log-2.1.6.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- nati_log/__init__.py,sha256=hk7FdUPg_4nqaXVqpJLwPqrRpwiw78q1cTN46MZXTsU,33
2
- nati_log/client.py,sha256=iWHK7gTIEANS8a0qUCdWUiWeE5w6WSbHo-nRDACPse0,3325
3
- nati_log/middleware.py,sha256=lBn0Fm9PYsPwLAUZKvSZp2SD6gzn63TPhitU5RoY-Ek,2951
4
- nati_log-2.1.4.dist-info/METADATA,sha256=fsItUdRiXIkaqA62ufRwdBFuGv1q7jzvHdunpLsf2HU,245
5
- nati_log-2.1.4.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
6
- nati_log-2.1.4.dist-info/top_level.txt,sha256=lgrIlHI78ZiRKmSnTdwr5dh9AyCDexp2JRGAbcl4lss,9
7
- nati_log-2.1.4.dist-info/RECORD,,