-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCep.py
More file actions
35 lines (22 loc) · 951 Bytes
/
Cep.py
File metadata and controls
35 lines (22 loc) · 951 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import requests
import json
import webbrowser
inputCep= input('Digite o cep:')
if len(inputCep) != 8:
print('CEP invalido')
exit()
requests = requests.get('https://cep.awesomeapi.com.br/json/{}'.format(inputCep))
retornoCep = requests.json()
#openInBrowserMap= 'https://www.google.com/maps/search/?api=1&query={},{}'.format(input)
#print(retornoCep)
print("Cep:{}".format(retornoCep['cep']))
print("Rua:{}".format(retornoCep['address_name']))
print("Bairro:{}".format(retornoCep['district']))
print("Cidade:{}".format(retornoCep['city']))
print("Estado:{}".format(retornoCep['state']))
print('Latitude:{}'.format(retornoCep['lat']))
print('Longitude:{}'.format(retornoCep['lng']))
Latitude='{}'.format(retornoCep['lat'])
Longitude='{}'.format(retornoCep['lng'])
openInBrowserMap= 'https://www.google.com/maps/search/?api=1&query='+Latitude+','+Longitude+''
webbrowser.open_new(openInBrowserMap)