Convert CEP (Brazilian zip code) to coordinates
Project description
Pacote Python para converter CEP em latitude e longitude
Como usar:
- Instale:
git clone https://github.com/millengustavo/cep-to-coords.git
cd cep-to-coords
git checkout master
pip install -e .
- Converta um CEP para latitude e longitude:
from cep_to_coords.convert import cep_to_coords
coordenadas = cep_to_coords('22070-900')
print(coordenadas)
# {'latitude': -22.9864082, 'longitude': -43.189592}
Opcional - Usando o https://cepaberto.com/
Para usar esse conversor você precisa se cadastrar no site e exportar seu token como variável de ambiente
CEP_ABERTO_TOKEN
export CEP_ABERTO_TOKEN='seu_token'
from cep_to_coords.convert import cep_to_coords
from cep_to_coords.strategies import CEPAbertoConverter
coordenadas = cep_to_coords('22070-900', factory=CEPAbertoConverter)
print(coordenadas)
# {'latitude': -22.9864082, 'longitude': -43.189592}
Testando
python -m unittest discover
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cep_to_coords-0.1.0.tar.gz
(3.4 kB
view hashes)
Built Distribution
Close
Hashes for cep_to_coords-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26267c5ec151b6658a581744f41465b6508772ae67a5423d1b85faf40c1ef26b |
|
MD5 | 746528da58980389d206399b3a887ec5 |
|
BLAKE2b-256 | dc7de78281d907ebd32391ede93fa44d797d4591b6d8085b15ba32511ea335b7 |