Find Brazilian addresses by zip code, directly from Correios database. No HTML parsers.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
lib/correios
test
.credo.exs
.formatter.exs
.gitignore
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE
README.md
dialyzer.ignore
mix.exs
mix.lock

README.md

Correios CEP

Hex.pm Docs Build Status Coverage Status License

Correios Logo

Find Brazilian addresses by zip code, directly from Correios database. No HTML parsers.

Installation

The package can be installed by adding correios_cep to your list of dependencies in mix.exs:

def deps do
  [{:correios_cep, "~> 0.3"}]
end

Usage

iex> Correios.CEP.find_address("54250610")
{:ok,
 %Correios.CEP.Address{
   city: "Jaboatão dos Guararapes",
   complement: "",
   neighborhood: "Cavaleiro",
   state: "PE",
   street: "Rua Fernando Amorim",
   zipcode: "54250610"
 }}

iex> Correios.CEP.find_address("00000-000")
{:error, %Correios.CEP.Error{reason: "CEP NAO ENCONTRADO"}}

iex> Correios.CEP.find_address!("54250-610")
%Correios.CEP.Address{
  city: "Jaboatão dos Guararapes",
  complement: "",
  neighborhood: "Cavaleiro",
  state: "PE",
  street: "Rua Fernando Amorim",
  zipcode: "54250610"
}

iex> Correios.CEP.find_address!("00000-000")
** (Correios.CEP.Error) CEP NAO ENCONTRADO

Options

Options for timeout are supported. Refer to Correios.CEP.find_address/2 to see all available options.

The full documentation is available at https://hexdocs.pm/correios_cep.

Contributing

See the contributing guide.

License

Correios CEP is released under the Apache 2.0 License. See the LICENSE file.

Author

Fernando Hamasaki de Amorim (prodis)

Prodis Logo