rodrigosantosbr

[Py] Get CNPj / Pessoa Jurídica data from ReceitaWS

Jan 8th, 2019 (edited)
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. import requests
  2. import json
  3.  
  4. """
  5. free: limitada a 3 consultas por minuto
  6. """
  7. def getDadosPessoaJuridicaReceitaWS(cnpj):
  8.     url = "https://www.receitaws.com.br/v1/cnpj/{}".format(cnpj)
  9.     try:
  10.         uResponse = requests.get(url, headers={}, timeout=170)
  11.     except:
  12.         return ""  
  13.     Jresponse = uResponse.content
  14.     data = json.loads(Jresponse, encoding='utf-8')
  15.     return data
Add Comment
Please, Sign In to add comment