Spaces:
Runtime error
Runtime error
File size: 311 Bytes
e4d11a3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import requests
import re
def formatar_cep(cep):
return re.sub(r"[^0-9]", "", cep).zfill(8)[:5] + "-" + re.sub(r"[^0-9]", "", cep).zfill(8)[5:]
def obter_endereco(cep):
url = f"https://cdn.apicep.com/file/apicep/{cep}.json"
resposta = requests.get(url)
data = resposta.json()
return data |