csc-cia-stne 0.1.25__py3-none-any.whl → 0.1.26__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.
@@ -441,11 +441,18 @@ class StoneAdmin:
441
441
  documento = re.sub(r"\D", "", documento)
442
442
  filtro = {'document': documento}
443
443
  param = {
444
- 'filter': json.dumps(filtro) # Transforma o dicionário em uma string JSON
444
+ 'filter': json.dumps(filtro), # Transforma o dicionário em uma string JSON
445
+ 'sort': json.dumps(['created_at','DESC'])
445
446
  }
446
447
  try:
447
448
  response = requests.get(f"{self.base_url}/users", params=param, headers=self.authenticated_header)
448
- return {"success": True, "status_code": response.status_code, "data": response.json()}
449
+ if response.status_code == 401 and 'unauthenticated' in str(response.json()):
450
+ self.renew_authorization()
451
+ return self.__detalhar_titular_cpf(documento=documento)
452
+ elif response.status_code != 200:
453
+ return {"success": False, "status_code": response.status_code, "error": f"{response.text}"}
454
+ else:
455
+ return {"success": True, "status_code": response.status_code, "data": response.json()}
449
456
  except Exception as e:
450
457
  return {"success": False, "status_code": 500, "error": str(e)}
451
458
 
@@ -475,11 +482,18 @@ class StoneAdmin:
475
482
  filtro = {'document': documento}
476
483
 
477
484
  param = {
478
- 'filter': json.dumps(filtro) # Transforma o dicionário em uma string JSON
485
+ 'filter': json.dumps(filtro), # Transforma o dicionário em uma string JSON
486
+ 'sort': json.dumps(['created_at','DESC'])
479
487
  }
480
488
  try:
481
489
  response = requests.get(f"{self.base_url}/organizations", params=param, headers=self.authenticated_header)
482
- return {"success": True, "status_code": response.status_code, "data": response.json()}
490
+ if response.status_code == 401 and 'unauthenticated' in str(response.json()):
491
+ self.renew_authorization()
492
+ return self.__detalhar_titular_cnpj(documento=documento)
493
+ elif response.status_code != 200:
494
+ return {"success": False, "status_code": response.status_code, "error": f"{response.text}"}
495
+ else:
496
+ return {"success": True, "status_code": response.status_code, "data": response.json()}
483
497
  except Exception as e:
484
498
  return {"success": False, "status_code": 500, "error": str(e)}
485
499
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: csc_cia_stne
3
- Version: 0.1.25
3
+ Version: 0.1.26
4
4
  Summary: Biblioteca do time CSC-CIA utilizada no desenvolvimento de RPAs
5
5
  License: MIT
6
6
  Keywords: karavela,csc,cia,stone,rpa,botcity,stne
@@ -12,7 +12,7 @@ csc_cia_stne/logger_rich.py,sha256=fklgkBb4rblKQd7YZ3q-eWfhGg9eflO2k2-z4pGh_yo,5
12
12
  csc_cia_stne/provio.py,sha256=G-pDnHYLSp97joc7S7dvwjNvl3omnTmvdi3rOPQf5GA,3987
13
13
  csc_cia_stne/servicenow.py,sha256=PUGN6bjcQ25hf-bwVuuKsnRKdqYTaYZ1Uh7QHn9OM24,35350
14
14
  csc_cia_stne/slack.py,sha256=sPLeaQh_JewLcrBDjjwUgbjtC7d1Np03OTy06JimMV4,8117
15
- csc_cia_stne/stne_admin.py,sha256=Xjp8IJ3QmK5ABxYcsrt4XTEPUXP3U1Kti9ruReQWPf8,27880
15
+ csc_cia_stne/stne_admin.py,sha256=tbRN_l3y---GHlQoAAjlZP92wnVA73hUmk9hQxKavH8,28753
16
16
  csc_cia_stne/wacess.py,sha256=g-bWZNpm_tU7UsW1G_rqh_2fW2KShvxZHGOerX8DuQw,26768
17
17
  csc_cia_stne/web.py,sha256=TBXUJ5eS36fytU3oFDuJsogi0sgw_qKgK-uphx4Nvxo,2506
18
18
  csc_cia_stne/utilitarios/__init__.py,sha256=ul7p-4XduFOQW2ldKSIbTQb3eq7h5O1l8IwSP7b5KgY,410
@@ -38,8 +38,8 @@ csc_cia_stne/utilitarios/web_screen/__init__.py,sha256=5QcOPXKd95SvP2DoZiHS0gaU6
38
38
  csc_cia_stne/utilitarios/web_screen/web_screen_abstract.py,sha256=PjL8Vgfj_JdKidia7RFyCkro3avYLQu4RZRos41sh3w,3241
39
39
  csc_cia_stne/utilitarios/web_screen/web_screen_botcity.py,sha256=Xi5YJjl2pcxlX3OimqcBWRNXZEpAE7asyUjDJ4Oho5U,12297
40
40
  csc_cia_stne/utilitarios/web_screen/web_screen_selenium.py,sha256=JLIcPJE9ZX3Pd6zG6oTRMqqUAY063UzLY3ReRlxmiSM,15581
41
- csc_cia_stne-0.1.25.dist-info/licenses/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
42
- csc_cia_stne-0.1.25.dist-info/METADATA,sha256=klgYUqOj8pEqVBRW7WrSVHSMo85Y1jGWX8ta4D_NPeY,1464
43
- csc_cia_stne-0.1.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
- csc_cia_stne-0.1.25.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
45
- csc_cia_stne-0.1.25.dist-info/RECORD,,
41
+ csc_cia_stne-0.1.26.dist-info/licenses/LICENCE,sha256=LPGMtgKki2C3KEZP7hDhA1HBrlq5JCHkIeStUCLEMx4,1073
42
+ csc_cia_stne-0.1.26.dist-info/METADATA,sha256=m5FbcB2lH355cKd3_srrYQd9dH8n2bDkpvKD00o-xRg,1464
43
+ csc_cia_stne-0.1.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
44
+ csc_cia_stne-0.1.26.dist-info/top_level.txt,sha256=ldo7GVv3tQx5KJvwBzdZzzQmjPys2NDVVn1rv0BOF2Q,13
45
+ csc_cia_stne-0.1.26.dist-info/RECORD,,