Skip to content

Instantly share code, notes, and snippets.

@shazaum
Last active June 27, 2017 11:13
Show Gist options
  • Save shazaum/c3f31d41e2988d58470c7efba836dce1 to your computer and use it in GitHub Desktop.
Save shazaum/c3f31d41e2988d58470c7efba836dce1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import requests
import sys
from asterisk.agi import *
agi = AGI()
payload={'token':'8978-23-4-324-23-423-3',
'app': 'ura',
'cpfcnpj':sys.argv[1]}
url_request='https://servidor.com/ura/cliente/'
r = requests.post(url=url_request,data=payload)
resposta = r.json()
contratos = resposta.get('contratos')
if contratos:
print contratos[0].get('razaoSocial')
agi.set_variable('nome_res', contratos[0].get('razaoSocial'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment