Integração com API da Vindi (Python 3.6+)
Project description
Integração com API da Vindi (Python 3.5+).
Como instalar
pip install vindi
Tutorial
>>> # import inicial
>>> from vindi.api import get_api_instance
>>> # criando uma nova instância da api
>>> api = get_api_instance(token='seu-token-da-vindi')
>>> # listando todos os resources disponíveis
>>> api.get_resource_list()
['customers', 'plans', 'products', 'payment_methods', 'discounts', 'subscriptions', 'product_items', 'periods', 'bills', 'bill_items', 'charges', 'transactions', 'payment_profiles', 'usages', 'invoices', 'movements', 'messages', 'import_batches', 'merchant', 'issues']
>>> # listando todas as ações disponíveis para o resource customers
>>> api.customers.actions
{'list': {'method': 'GET', 'url': 'customers'}, 'create': {'method': 'POST', 'url': 'customers'}, 'retrieve': {'method': 'GET', 'url': 'customers/{}'}, 'update': {'method': 'PUT', 'url': 'customers/{}'}, 'destroy': {'method': 'DELETE', 'url': 'customers/{}'}}
>>> # executando ação list com todos os parâmetros possíveis
>>> response = api.customers.list(body=None, params={}, headers={})
>>> # trabalhando com uma instância response
>>> response.url
'https://app.vindi.com.br/api/v1/customers'
>>> response.method
'GET'
>>> response.headers
{'Cache-Control': 'max-age=0, private, must-revalidate', 'Content-Type': 'application/json; charset=UTF-8', 'Date': 'Fri, 21 Apr 2017 15:30:11 GMT', 'ETag': 'W/"0cbcb8ab8eb167a7525bdc61c7b89ba3"', 'Per-Page': '25', 'Rate-Limit-Limit': '120', 'Rate-Limit-Remaining': '119', 'Rate-Limit-Reset': '1492788671', 'Server': 'nginx', 'Total': '2', 'Vindi-Merchant-Id': '5963', 'X-Request-Id': 'd155bf74-df8e-4803-8281-8f1fe0373814', 'X-Runtime': '0.034142', 'Content-Length': '773', 'Connection': 'keep-alive'}
>>> response.body
{'customers': [{'id': 2481112, 'name': 'Jane Doe', 'email': 'jane@doe.com', 'registry_code': None, 'code': None, 'notes': None, 'status': 'archived', 'created_at': '2017-04-19T13:08:51.000-03:00', 'updated_at': '2017-04-19T13:25:57.000-03:00', 'metadata': {}, 'address': {'street': None, 'number': None, 'additional_details': None, 'zipcode': None, 'neighborhood': None, 'city': None, 'state': None, 'country': None}, 'phones': []}, {'id': 2481258, 'name': 'John Doe', 'email': 'john@doe.com', 'registry_code': None, 'code': None, 'notes': None, 'status': 'inactive', 'created_at': '2017-04-19T13:27:35.000-03:00', 'updated_at': '2017-04-19T13:27:35.000-03:00', 'metadata': {}, 'address': {'street': None, 'number': None, 'additional_details': None, 'zipcode': None, 'neighborhood': None, 'city': None, 'state': None, 'country': None}, 'phones': []}]}
>>> response.status_code
200
>>> # fim \o/
Usando o ambiente sandbox
>>> # import inicial
>>> from vindi.api import get_api_instance
>>> # criando uma nova instância da api
>>> api = get_api_instance(token='seu-token-da-vindi', api_root_url='https://sandbox-app.vindi.com.br/api/v1/')
Verifique a documentação da API Vindi.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vindi-1.0.0.tar.gz
(5.3 kB
view details)
Built Distribution
vindi-1.0.0-py3-none-any.whl
(5.2 kB
view details)
File details
Details for the file vindi-1.0.0.tar.gz
.
File metadata
- Download URL: vindi-1.0.0.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 647e710157c11cf5893b4c955fc0fa0cbc4eecac6e8dc521d02ba0abef44fae0 |
|
MD5 | 1c73ee23257d9bca775111a892ffc074 |
|
BLAKE2b-256 | 91a1e77a0aec60d863e14abf4d0a94c35e4f65021d32ccaea32262adcbf91940 |
File details
Details for the file vindi-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: vindi-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | faff5e69e31e63f05c2cb1b2f7b36109c7be39283bf1ad95a71099968e033663 |
|
MD5 | 8ed8eaccbbfd2836ff7bfbc9144b07f8 |
|
BLAKE2b-256 | b3c1d8c08f2f0fe6f5fa97d4440bf87b438ff1e8a4d71af93f7ed2767ab453c1 |