Skip to content
Permalink
Browse files

Preparando a versão 0.2.0.

  • Loading branch information...
allisson committed Sep 19, 2017
1 parent 128b130 commit 28096f27fe5b88b8fd4eb1b7a5778ad676cc1802
Showing with 27 additions and 2 deletions.
  1. +5 −0 CHANGES.rst
  2. +12 −0 README.rst
  3. +8 −0 tests/test_api.py
  4. +2 −2 vindi/api.py
@@ -1,6 +1,11 @@
Changelog
---------

0.2.0
~~~~~

* Adicionado o parâmetro api_root_url na função get_api_instance.

0.1.0
~~~~~

@@ -47,6 +47,18 @@ Tutorial
200
>>> # fim \o/
Usando o ambiente sandbox
-------------------------

.. code:: python
>>> # 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`_.

.. _`API Vindi`: https://vindi.github.io/api-docs/dist/
@@ -7,3 +7,11 @@ def test_get_api_instance():
assert api.headers['Authorization'] == 'Basic Og=='
assert api.headers['Content-Type'] == 'application/json'
assert api.json_encode_body


def test_get_api_instance_with_api_root_url():
api = get_api_instance(token='', api_root_url='https://sandbox-app.vindi.com.br/api/v1/')
assert api.api_root_url == 'https://sandbox-app.vindi.com.br/api/v1/'
assert api.headers['Authorization'] == 'Basic Og=='
assert api.headers['Content-Type'] == 'application/json'
assert api.json_encode_body
@@ -4,7 +4,7 @@
from vindi import resource


def get_api_instance(token='', timeout=3):
def get_api_instance(token='', api_root_url=None, timeout=3):
headers = {
'Authorization': basic_http_auth(token, ''),
'Content-Type': 'application/json'
@@ -13,7 +13,7 @@ def get_api_instance(token='', timeout=3):
'Authorization': basic_http_auth(token, ''),
'Content-Type': 'multipart/form-data'
}
api_root_url = 'https://app.vindi.com.br/api/v1/'
api_root_url = api_root_url or 'https://app.vindi.com.br/api/v1/'
api = API(
api_root_url=api_root_url, headers=headers, json_encode_body=True,
timeout=timeout

0 comments on commit 28096f2

Please sign in to comment.
You can’t perform that action at this time.