marvinamorim

Untitled

Feb 2nd, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. BEARER = ""
  2. def GetCNPJSit(cnpj):
  3.   url = "https://www.receitaws.com.br/v1/cnpj/" + cnpj + "/days/1"
  4.   token = "Bearer "+BEARER
  5.   headers = {'Authorization:': 'token %s' % token}
  6.   try:
  7.     req = urllib.request.Request(url)
  8.     req.add_header('Authorization', token)
  9.     resp = urllib.request.urlopen(req).read()
  10.     obj = json.loads(resp)
  11.     return obj
  12.   except Exception:
  13.     raise
Advertisement
Add Comment
Please, Sign In to add comment