Skip to main content

Python package for handle Nicaragua postal codes

Project description

postalcodes-ni

Python package for handle Nicaragua postal codes

made-with-python made-with-python PyPI version Travis-ci GitHub version Documentation Status

Quickstart

Install postalcodes-ni:

$ pip install postalcodes-ni

Then use it in your project:

from postalcodes_ni import (
    get_all_municipalities_by_iso, get_all_municipalities_by_postal,
    get_municipality_by_name, get_municipality_by_postal
)

You can find the documentation in https://postalcodes-ni.readthedocs.io

This package uses data from those websites:

Usage

postalcodes_ni exposes the following methods:

  • get_all_municipalities_by_iso for get all the municipalities in a department using the ISO code - Ex MN for Managua department.
  • get_all_municipalities_by_postal for get all the municipalities in a department using the postal code - Ex 10000 for Managua department.
  • get_municipality_by_name for get an specific municipality using his name - Ex Altagracia for the Rivas department.
  • get_municipality_by_postal for get an specific municipality using his postal code - Ex 48800 for the municipality of Altagracia from Rivas department.

Example

First, you need import the methods that you want to use

from postalcodes_ni import (
    get_all_municipalities_by_iso, get_all_municipalities_by_postal,
    get_municipality_by_name, get_municipality_by_postal
)

For get all the municipalities in a department use the following methods

>>> # Get all the municipalities in Carazo department using iso code
>>> get_all_municipalities_by_iso('CA')
[('Jinotepe', 45000), ('Dolores', 46100), ('El Rosario', 46200), ...]

>>> # Get all the municipalities in Carazo department using postal code
>>> get_all_municipalities_by_postal(45000)
[('Jinotepe', 45000), ('Dolores', 46100), ('El Rosario', 46200), ...]

For get an specific municipality in a department use the following methods

>>> # Get a municipality using his name
>>> get_municipality_by_name('nindiri')
('Nindirí', 42200)

>>> # Get a municipality using his postal code
>>> get_municipality_by_postal(42500)
('Catarina', 42500)

Running Tests

Does the code actually work?

$ source env/bin/activate
(env) $ pip install -r requirements_dev.txt
(env) $ make test-all

History

1.0.0 (2019-03-27)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postalcodes_ni-1.1.1.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

postalcodes_ni-1.1.1-py2.py3-none-any.whl (16.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file postalcodes_ni-1.1.1.tar.gz.

File metadata

  • Download URL: postalcodes_ni-1.1.1.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for postalcodes_ni-1.1.1.tar.gz
Algorithm Hash digest
SHA256 15c6f2250acc63643f7208bbc695bc47cc8a9a6bac1c12f47d3d50e422bf312c
MD5 e9cd5b4c5fec2a9aba4f3d3c9d66ffce
BLAKE2b-256 fc376d7ae6e32897cfaaa2ec4f06641508a41831892a405f8cd3d320abd81a99

See more details on using hashes here.

Provenance

File details

Details for the file postalcodes_ni-1.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: postalcodes_ni-1.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for postalcodes_ni-1.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b2ab39ad54a9c57ff470875f2b80ffa1f66690f093345c5c388807fbbaf59664
MD5 ff40209e8aa05c4ddebb8c3fecb66094
BLAKE2b-256 ebcba6e3febb80e2546529412b75f5d1b0a42f41fa2a0704bb1619c300cb19fa

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page