recete-python-sdk 1.0.0__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.
- __init__.py +0 -0
- recete/__init__.py +0 -0
- recete/api.py +40 -0
- recete/apis/__init__.py +0 -0
- recete/apis/consulta.py +20 -0
- recete/apis/log_query.py +32 -0
- recete_python_sdk-1.0.0.dist-info/METADATA +21 -0
- recete_python_sdk-1.0.0.dist-info/RECORD +11 -0
- recete_python_sdk-1.0.0.dist-info/WHEEL +5 -0
- recete_python_sdk-1.0.0.dist-info/licenses/LICENSE +5 -0
- recete_python_sdk-1.0.0.dist-info/top_level.txt +2 -0
__init__.py
ADDED
|
File without changes
|
recete/__init__.py
ADDED
|
File without changes
|
recete/api.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import os, jsonpickle
|
|
2
|
+
from http import HTTPMethod
|
|
3
|
+
|
|
4
|
+
from fmconsult.http.api import ApiBase
|
|
5
|
+
from fmconsult.utils.url import UrlUtil
|
|
6
|
+
|
|
7
|
+
class ReceteApi(ApiBase):
|
|
8
|
+
|
|
9
|
+
def __init__(self):
|
|
10
|
+
try:
|
|
11
|
+
self.api_domain = os.environ['recete.api.domain']
|
|
12
|
+
self.api_email = os.environ['recete.api.email']
|
|
13
|
+
self.api_pass = os.environ['recete.api.pass']
|
|
14
|
+
|
|
15
|
+
self.base_url = 'https://o61rua0rna.execute-api.eu-central-1.amazonaws.com/main'
|
|
16
|
+
self.headers = {}
|
|
17
|
+
|
|
18
|
+
self.__login()
|
|
19
|
+
except:
|
|
20
|
+
raise
|
|
21
|
+
def __login(self):
|
|
22
|
+
try:
|
|
23
|
+
res = self.call_request(
|
|
24
|
+
http_method = HTTPMethod.POST,
|
|
25
|
+
request_url = UrlUtil().make_url(self.base_url, ['user','login']),
|
|
26
|
+
payload = {
|
|
27
|
+
'email': self.api_email,
|
|
28
|
+
'pass': self.api_pass,
|
|
29
|
+
'api_token': self.api_token,
|
|
30
|
+
'neverExpires': True
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
res = jsonpickle.decode(res)
|
|
34
|
+
if not res['data'].get('error'):
|
|
35
|
+
self.token = res['data'].get('token')
|
|
36
|
+
self.headers['Authorization'] = self.token
|
|
37
|
+
else:
|
|
38
|
+
raise Exception(res['mensagem'])
|
|
39
|
+
except:
|
|
40
|
+
raise
|
recete/apis/__init__.py
ADDED
|
File without changes
|
recete/apis/consulta.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import logging, jsonpickle, json
|
|
2
|
+
from http import HTTPMethod
|
|
3
|
+
|
|
4
|
+
from fmconsult.utils.url import UrlUtil
|
|
5
|
+
|
|
6
|
+
from recete.api import ReceteApi
|
|
7
|
+
|
|
8
|
+
class ConsultaApi(ReceteApi):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__()
|
|
11
|
+
self.endpoint_url = UrlUtil().make_url(self.base_url, ['consulta'])
|
|
12
|
+
|
|
13
|
+
def get_fd_scpc_person_type(self, person_type, document_number):
|
|
14
|
+
try:
|
|
15
|
+
payload = { person_type: document_number }
|
|
16
|
+
res = self.call_request(HTTPMethod.POST, self.endpoint_url, None, payload=payload)
|
|
17
|
+
res = jsonpickle.decode(res)
|
|
18
|
+
return res
|
|
19
|
+
except:
|
|
20
|
+
raise
|
recete/apis/log_query.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import logging, jsonpickle, json
|
|
2
|
+
from http import HTTPMethod
|
|
3
|
+
|
|
4
|
+
from fmconsult.utils.url import UrlUtil
|
|
5
|
+
|
|
6
|
+
from recete.api import ReceteApi
|
|
7
|
+
|
|
8
|
+
class LogQueryApi(ReceteApi):
|
|
9
|
+
def __init__(self):
|
|
10
|
+
super().__init__()
|
|
11
|
+
self.endpoint_url = UrlUtil().make_url(self.base_url, ['logquery'])
|
|
12
|
+
|
|
13
|
+
def get_search_grid(self, search_term, skip=0, limit=10, sort='-startAt'):
|
|
14
|
+
try:
|
|
15
|
+
params = {
|
|
16
|
+
'skip': skip,
|
|
17
|
+
'limit': limit,
|
|
18
|
+
'sort': sort
|
|
19
|
+
}
|
|
20
|
+
payload = {
|
|
21
|
+
'term': search_term
|
|
22
|
+
}
|
|
23
|
+
res = self.call_request(
|
|
24
|
+
http_method=HTTPMethod.POST,
|
|
25
|
+
request_url=self.endpoint_url,
|
|
26
|
+
params=params,
|
|
27
|
+
payload=payload
|
|
28
|
+
)
|
|
29
|
+
res = jsonpickle.decode(res)
|
|
30
|
+
return res
|
|
31
|
+
except:
|
|
32
|
+
raise
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: recete-python-sdk
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Client de comunicaçao c/ API da Recete
|
|
5
|
+
Author-email: Filipe Coelho <filipe@fmconsult.com.br>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2025 Seu Nome
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy...
|
|
11
|
+
|
|
12
|
+
Project-URL: Homepage, https://github.com/seuuser/minha-biblioteca
|
|
13
|
+
Project-URL: Bug Tracker, https://github.com/seuuser/minha-biblioteca/issues
|
|
14
|
+
Keywords: sdk,api,recete
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Requires-Python: >=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
recete/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
recete/api.py,sha256=7YTzbUz_pDtBwUnAtO2RiJ7vFbgWnqb60ANV0j1mpDQ,1110
|
|
4
|
+
recete/apis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
recete/apis/consulta.py,sha256=rMLY_0oiXMLgQA6DLeVo-D-CCMBKi2LHLmNaHet4Guw,628
|
|
6
|
+
recete/apis/log_query.py,sha256=T34x6tEufU-aCsacmuT5fX-SuKgJNLVV0GAGvdky3_c,899
|
|
7
|
+
recete_python_sdk-1.0.0.dist-info/licenses/LICENSE,sha256=YZjQnFjzXGFa0D3iCQkNDwGBNuTGJREkRmItGX1B3YM,122
|
|
8
|
+
recete_python_sdk-1.0.0.dist-info/METADATA,sha256=3WLthUQePXFHlum7s8PHJAJVd6BqQQtzp7tbYksC1k4,759
|
|
9
|
+
recete_python_sdk-1.0.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
10
|
+
recete_python_sdk-1.0.0.dist-info/top_level.txt,sha256=6w1U_0c6r5nW9yVURko96itWYe7nfok1fqHBb22VQPI,16
|
|
11
|
+
recete_python_sdk-1.0.0.dist-info/RECORD,,
|