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 details)
Built Distribution
File details
Details for the file cep_to_coords-0.1.0.tar.gz
.
File metadata
- Download URL: cep_to_coords-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19fdda553cdeddfe40ca5f7dc5738d97db4f6fda68a93a33d9b047587d4ef998 |
|
MD5 | 95f7c5cb8f23b8521366731a4f6c81d5 |
|
BLAKE2b-256 | b8595a4c734895c725aa27bef1aa46e8d9e7ed0815f85dd8f169146cf86192ed |
File details
Details for the file cep_to_coords-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: cep_to_coords-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0.post20210125 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26267c5ec151b6658a581744f41465b6508772ae67a5423d1b85faf40c1ef26b |
|
MD5 | 746528da58980389d206399b3a887ec5 |
|
BLAKE2b-256 | dc7de78281d907ebd32391ede93fa44d797d4591b6d8085b15ba32511ea335b7 |