Last active
June 27, 2017 11:13
-
-
Save shazaum/c3f31d41e2988d58470c7efba836dce1 to your computer and use it in GitHub Desktop.
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
#!/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