-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
157 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
Metadata-Version: 2.1 | ||
Name: apigratis-sdk-python | ||
Version: 1.0.1 | ||
Summary: Transforme seus projetos em soluções inteligentes com nossa API. Com recursos como API do WhatsApp, geolocalização, rastreamento de encomendas, verificação de CPF/CNPJ e mais, você pode criar soluções eficientes e funcionais | ||
Home-page: https://github.com/APIBrasil/apigratis-sdk-python | ||
Author: APIBRASIL | ||
Author-email: contato@apibrasil.com.br | ||
License: MIT License | ||
Description: # SDK Python - APIGratis by API BRASIL | ||
|
||
Conjunto de API, para desenvolvedores. | ||
|
||
_Transforme seus projetos em solucoes inteligentes com nossa API. Com recursos como API do WhatsApp, geolocalizacao, rastreamento de encomendas, verificacao de CPF/CNPJ e mais, voce pode criar solucoes eficientes e funcionais._ | ||
|
||
## Como instalar | ||
|
||
```pip install apigratis``` | ||
## Canais de suporte (Comunidade) | ||
[![WhatsApp Group](https://img.shields.io/badge/WhatsApp-Group-25D366?logo=whatsapp)](https://chat.whatsapp.com/KsxrUGIPWvUBYAjI1ogaGs) | ||
[![Telegram Group](https://img.shields.io/badge/Telegram-Group-32AFED?logo=telegram)](https://t.me/apigratisoficial) | ||
|
||
## Obtenha suas credenciais | ||
https://apigratis.com.br | ||
|
||
## Mais informacoes | ||
|
||
https://pypi.org/project/apigratis | ||
|
||
## Servicos de API disponiveis | ||
|
||
| Up | Services available | Description | Free | Beta | Stable | | ||
------|-------------------------------|-------------------|---------| ------------------------- | ------------------------- | | ||
| O | WhatsAppService | API do WhatsApp Gratuita. | O | O | x | | ||
| x | Receita Data CNPJ | API Dados CNPJ Receita. | x | x | x | | ||
| x | Receita Data CPF | API Dados de CPF Serasa. | x | x | x | | ||
| x | CorreiosService | API Busca encomendas Correios Brazil. | x | x | x | | ||
| x | CEPLocation | API CEP Geolocation + IBGE Brazil. | x | x | x | | ||
| x | VehiclesService | API Placa Dados. | x | x | x | | ||
| x | FipeService | API Placa FIPE. | x | x | x | | ||
|
||
## Como utilizar | ||
|
||
_Voce pode utilizar todos os endpoints da API do WhatsApp, basta mudar o action e o body_ | ||
|
||
## Documentacoes | ||
https://apibrasil.com.br/documentacoes | ||
|
||
|
||
```python | ||
|
||
from apigratis.Service import Service | ||
import json | ||
|
||
def main(): | ||
|
||
sendText = Service.whatsapp(json.dumps({ | ||
"action": "sendText", | ||
"credentials": { | ||
"SecretKey": "SEU_SECRET_KEY", | ||
"PublicToken": "SEU_PUBLIC_TOKEN", | ||
"DeviceToken": "SEU_DEVICE_TOKEN", | ||
"BearerToken": "SEU_BEARER_TOKEN", | ||
}, | ||
"body": { | ||
"message": "Hello World for Python", | ||
"phone": "5531994359434", | ||
"time_typing": 1 | ||
} | ||
})) | ||
|
||
print(sendText) | ||
|
||
if __name__ == "__main__": | ||
main() | ||
``` | ||
|
||
Keywords: whatsapp api,apibrasil,cnpj,sms,cep,consulta,api,brasil,gratis,free,whatsapp,apiwhatsapp,apigratis,apifree | ||
Platform: UNKNOWN | ||
Description-Content-Type: text/markdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
README | ||
pyproject.toml | ||
setup.py | ||
apigratis-sdk-python/Service.py | ||
apigratis-sdk-python/__init__.py | ||
apigratis_sdk_python.egg-info/PKG-INFO | ||
apigratis_sdk_python.egg-info/SOURCES.txt | ||
apigratis_sdk_python.egg-info/dependency_links.txt | ||
apigratis_sdk_python.egg-info/requires.txt | ||
apigratis_sdk_python.egg-info/top_level.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
apigratis-sdk-python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import requests | ||
import json | ||
|
||
class Service: | ||
|
||
def whatsapp(dados): | ||
|
||
try: | ||
server = "https://cluster-01.apigratis.com/api/v1/whatsapp/" | ||
|
||
data = json.loads(dados) | ||
|
||
if not data['action']: | ||
raise Exception('Action não informada, verifique a documentação') | ||
|
||
action = data['action'] | ||
|
||
url = server+str(action) | ||
|
||
if not data['body']: | ||
raise Exception('Body não informado, verifique a documentação') | ||
|
||
payload = json.dumps(data['body']) | ||
|
||
credentials = data['credentials'] | ||
|
||
if not credentials['SecretKey']: | ||
raise Exception('SecretKey não informado') | ||
if not credentials['PublicToken']: | ||
raise Exception('PublicToken não informado') | ||
if not credentials['BearerToken']: | ||
raise Exception('BearerToken não informado') | ||
if not credentials['DeviceToken']: | ||
raise Exception('DeviceToken não informado') | ||
|
||
headers = { | ||
'Content-Type': 'application/json', | ||
'SecretKey': credentials['SecretKey'], | ||
'PublicToken': credentials['PublicToken'], | ||
'Authorization': 'Bearer ' + credentials['BearerToken'], | ||
'DeviceToken': credentials['DeviceToken'] | ||
} | ||
|
||
agent = 'APIBRASIL\Whatsapp/1.0.0' | ||
|
||
headers['User-Agent'] = agent | ||
|
||
response = requests.request("POST", url, headers=headers, data=payload, allow_redirects=False, stream=True, proxies=None) | ||
|
||
return json.loads(response.text.encode('utf8')) | ||
|
||
except Exception as e: | ||
return {'error': str(e)} |
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters