{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","settings":"","params":[],"results":{"codes":[]}},"next":{"description":"","pages":[]},"title":"Python","type":"basic","slug":"instalacao-sdk-python","excerpt":"Saiba como instalar e configurar nossa SDK em Python para API Pix e API Boletos (Bolix)","body":"[block:html]\n{\n  \"html\": \"<p>Nossa API é <a href=\\\"https://en.wikipedia.org/wiki/Representational_state_transfer\\\" target=\\\"_blank\\\" title=\\\"Link Externo\\\">RESTful</a> e responde em <a href=\\\"http://www.json.org/\\\" target=\\\"_blank\\\" title=\\\"Link Externo\\\">JSON</a>. A Gerencianet utiliza <a href=\\\"http://oauth.net/\\\" target=\\\"_blank\\\" title=\\\"Link Externo\\\">OAuth</a> para fornecer acesso autorizado à <abbr title=\\\"Application Programming Interface\\\">API</abbr>. Nossa SDK de Python já está preparada para realizar essa autenticação automaticamente.</p>\"\n}\n[/block]\nA seguir, confira os procedimentos para instalação da <a href=\"https://github.com/gerencianet/gn-api-sdk-python\" target=\"_blank\" title=\"Link Externo\">SDK da Gerencianet em Python</a>:\n\n# Instalando via <a href=\"https://pypi.python.org/pypi/pip\" target=\"_blank\">Pip</a>\n\n<pre>$ pip install gerencianet</pre>\n\n# Testado com\n\n- Python <code>2.7</code>, <code>3.3</code>, <code>3.4</code> e <code>3.5</code>\n\n# Uso Básico\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# encoding: utf-8\\n\\nfrom gerencianet import Gerencianet\\n\\ncredentials = {\\n    'client_id': 'client_id',\\n    'client_secret': 'client_secret',\\n    'pix_cert': './seuCert.pem',\\n    'sandbox': True\\n}\\n\\ngn = Gerencianet(credentials)\\n\\nbody = {\\n    'items': [{\\n        'name': \\\"Product 1\\\",\\n        'value': 1000,\\n        'amount': 2\\n    }],\\n    'shippings': [{\\n        'name': \\\"Default Shipping Cost\\\",\\n        'value': 100\\n    }]\\n}\\n\\nprint gn.create_charge(body=body)\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n# Exemplos\n\nVocê pode executar os exemplos dentro de <code>examples</code> com <code>$ python examples/example.py</code>:\n\n<pre>$ python examples/create_charge.py</pre>\n\n<br>\n\nLembre-se de definir as credenciais corretas dentro de <code>examples/credentials.py</code> antes de executar.\n\n# Testes\n\nPara executar os testes, basta executar *pytest*:\n\n<pre>$ py.test</pre>","updates":[],"order":5,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"606f2ca7c5ba910078783483","project":"575aeffae12cf20e002f306c","user":"57601a13af3e090e00108059","createdAt":"2017-03-10T12:38:09.009Z","githubsync":"","parentDoc":null,"__v":0,"version":{"version":"1.1.0","version_clean":"1.1.0","codename":"2021","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["606f2ca6c5ba91007878342b","575af039a083950e004487f7","575af5c7ba4ed70e000ca288","606f2ca6c5ba91007878342c","606f2ca6c5ba91007878342d","606f2ca6c5ba91007878342e","606f2ca6c5ba91007878342f","5761a63d207db7170022fc14","5761b9a2b65324200072d79e","576832939f0bf4190014ffdf","576832c09f0bf4190014ffe1","576832cba151c10e004316f0","576832d5bb15f40e00a288ec","576832e107b1f30e0039c645","606f2ca6c5ba910078783430","606f2ca6c5ba910078783431","5783f78c5cbce30e0074e2b7","606f2ca6c5ba910078783432","606f2ca6c5ba910078783433","606f2ca6c5ba910078783434","606f2ca6c5ba910078783435","606f2ca6c5ba910078783436","606f2ca6c5ba910078783437","578529f887c9280e0090394b","606f2ca6c5ba910078783438","606f2ca6c5ba910078783439","606f2ca6c5ba91007878343a","606f2ca6c5ba91007878343b","606f2ca6c5ba91007878343c","606f2ca6c5ba91007878343d","606f2ca6c5ba91007878343e","606f2ca6c5ba91007878343f","606f2ca6c5ba910078783440","606f2ca6c5ba910078783441","60d61f026ddc3901a32ee5f1","60ec37c637005f015e54174e","61473375119247002a9c14d7"],"_id":"606f2ca7c5ba9100787834c6","project":"575aeffae12cf20e002f306c","createdAt":"2016-06-10T16:51:06.080Z","releaseDate":"2016-06-10T16:51:06.080Z","__v":3,"forked_from":"575aeffae12cf20e002f306f"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Instalação da API (SDK's)","slug":"instalação-da-api-sdks","order":7,"from_sync":false,"reference":false,"_id":"606f2ca6c5ba91007878343d","createdAt":"2017-03-10T12:37:05.075Z","project":"575aeffae12cf20e002f306c","version":"606f2ca7c5ba9100787834c6","__v":0}}

Python

Saiba como instalar e configurar nossa SDK em Python para API Pix e API Boletos (Bolix)

[block:html] { "html": "<p>Nossa API é <a href=\"https://en.wikipedia.org/wiki/Representational_state_transfer\" target=\"_blank\" title=\"Link Externo\">RESTful</a> e responde em <a href=\"http://www.json.org/\" target=\"_blank\" title=\"Link Externo\">JSON</a>. A Gerencianet utiliza <a href=\"http://oauth.net/\" target=\"_blank\" title=\"Link Externo\">OAuth</a> para fornecer acesso autorizado à <abbr title=\"Application Programming Interface\">API</abbr>. Nossa SDK de Python já está preparada para realizar essa autenticação automaticamente.</p>" } [/block] A seguir, confira os procedimentos para instalação da <a href="https://github.com/gerencianet/gn-api-sdk-python" target="_blank" title="Link Externo">SDK da Gerencianet em Python</a>: # Instalando via <a href="https://pypi.python.org/pypi/pip" target="_blank">Pip</a> <pre>$ pip install gerencianet</pre> # Testado com - Python <code>2.7</code>, <code>3.3</code>, <code>3.4</code> e <code>3.5</code> # Uso Básico [block:code] { "codes": [ { "code": "# encoding: utf-8\n\nfrom gerencianet import Gerencianet\n\ncredentials = {\n 'client_id': 'client_id',\n 'client_secret': 'client_secret',\n 'pix_cert': './seuCert.pem',\n 'sandbox': True\n}\n\ngn = Gerencianet(credentials)\n\nbody = {\n 'items': [{\n 'name': \"Product 1\",\n 'value': 1000,\n 'amount': 2\n }],\n 'shippings': [{\n 'name': \"Default Shipping Cost\",\n 'value': 100\n }]\n}\n\nprint gn.create_charge(body=body)", "language": "python" } ] } [/block] # Exemplos Você pode executar os exemplos dentro de <code>examples</code> com <code>$ python examples/example.py</code>: <pre>$ python examples/create_charge.py</pre> <br> Lembre-se de definir as credenciais corretas dentro de <code>examples/credentials.py</code> antes de executar. # Testes Para executar os testes, basta executar *pytest*: <pre>$ py.test</pre>