blob: 3c22a1e66c817b9d9263af02a7edf70ab17a1037 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/api.R
\name{cep_lookup}
\alias{cep_lookup}
\title{Look up a single CEP}
\usage{
cep_lookup(cep, client = default_client())
}
\arguments{
\item{cep}{A length-one character vector: \code{"01001-000"} or \code{"01001000"}.}
\item{client}{A \code{\link[=cepis_client]{cepis_client()}}. Defaults to a shared client built with
the default configuration.}
}
\value{
A \link{cepis_address}.
}
\description{
Accepts the CEP masked or unmasked and returns everything the DNE database
has for it, including the coordinate when there is one.
}
\section{Conditions}{
\describe{
\item{\code{cepis_invalid_cep}}{the CEP is not 8 digits. No request is made.}
\item{\code{cepis_not_found}}{well-formed, but not in the database.}
\item{\code{cepis_rate_limited}}{429 on every attempt.}
\item{\code{cepis_server_error}}{5xx on every attempt.}
\item{\code{cepis_network_error}}{the request never completed.}
\item{\code{cepis_invalid_response}}{a success status with an unreadable
body.}
}
All of them inherit \code{cepis_error}; see \link{cepis_conditions}.
}
\examples{
\donttest{
address <- cep_lookup("01001-000")
address$localidade
if (!is.null(address$geo) && address$geo$is_precise) {
c(address$geo$lat, address$geo$lon)
}
}
}
|