Skip to main content

Pacote Python para converter CEP em latitude e longitude

Como usar:

  1. Instale:
git clone https://github.com/millengustavo/cep-to-coords.git
cd cep-to-coords
git checkout master
pip install -e .
  1. 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

Metadata

Release files for cep-to-coords 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cep-to-coords 0.1.0
File Size Uploaded
cep_to_coords-0.1.0.tar.gz 3.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cep-to-coords 0.1.0
File Interpreter ABI Platform
cep_to_coords-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / cep_to_coords-0.1.0.tar.gz

Download URL cep_to_coords-0.1.0.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
19fdda553cdeddfe40ca5f7dc5738d97db4f6fda68a93a33d9b047587d4ef998
BLAKE2b-256 checksum
How to use checksums
b8595a4c734895c725aa27bef1aa46e8d9e7ed0815f85dd8f169146cf86192ed
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / cep_to_coords-0.1.0-py3-none-any.whl

Download URL cep_to_coords-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26267c5ec151b6658a581744f41465b6508772ae67a5423d1b85faf40c1ef26b
BLAKE2b-256 checksum
How to use checksums
dc7de78281d907ebd32391ede93fa44d797d4591b6d8085b15ba32511ea335b7
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page