<reponame>cseiji/API-python<gh_stars>0
import requests

print ('#######################')
print ('#### consulta CEP #####')
print ('#######################')
print ('')

cep_input = input ('Digite o Cep para consulta: ')

if len (cep_input) != 8:
    print ('Quantidade de digitos inválida!!')
    exit

print('Resultados')

request = requests.get('https://viacep.com.br/ws/{}/json/'.format(cep_input))

print (request.json())

address_data = request.json()

if 'erro' not in address_data:
    print(request.json())
else:
    print('CEP invalido')



import requests

print ('#######################')
print ('#### consulta CEP #####')
print ('#######################')
print ('')

cep_input = input ('Digite o Cep para consulta: ')

if len (cep_input) != 8:
    print ('Quantidade de digitos inválida!!')
    exit

print('Resultados')

request = requests.get('https://viacep.com.br/ws/{}/json/'.format(cep_input))

print (request.json())

address_data = request.json()

if 'erro' not in address_data:
    print(request.json())
else:
    print('CEP invalido')
######################') ### consulta CEP #####') ######################')