From 58dbe934a90c1eda8e76cd218a413f01a4d9b11d Mon Sep 17 00:00:00 2001 From: Murilo Ijanc Date: Mon, 27 Jul 2026 20:33:25 -0300 Subject: Carry the municipality of a missing CEP on not_found MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A CEP that fails is rarely a random number: it is someone who knows the city and guessed the digits, and the classic guess is the -000 that 957 municipalities never received. The API now answers that 404 with an optional faixa block naming where the CEP would have been, so a caller can turn "CEP does not exist" into something the user can act on. It hangs off the error, never off an address: the lookup still failed. Parsing gives up quietly at every step — no block, a block that is not an object, one without a municipality to name — because a broken piece of context must not turn a clean not-found into a parse failure. cep_ini and cep_fim are the CEPs that exist, not the range the Correios publish, and the interval between them is sparse; ceps is what keeps the pair from being read as a list of valid CEPs. --- cepis-0.1.0-1.rockspec | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 cepis-0.1.0-1.rockspec (limited to 'cepis-0.1.0-1.rockspec') diff --git a/cepis-0.1.0-1.rockspec b/cepis-0.1.0-1.rockspec deleted file mode 100644 index c303f96..0000000 --- a/cepis-0.1.0-1.rockspec +++ /dev/null @@ -1,46 +0,0 @@ -rockspec_format = "3.0" -package = "cepis" -version = "0.1.0-1" - -source = { - url = "git+https://git.cep.is/lua.git", - tag = "v0.1.0", -} - -description = { - summary = "Lua client for the public CEP API at cep.is", - detailed = [[ - Looks a Brazilian CEP up against https://cep.is, which serves the official - Correios database (DNE) refreshed every two weeks, with coordinates for - about 57% of them. Single lookups, batches of up to 500 per request, and a - health endpoint. Retries 429 and 5xx with exponential backoff and full - jitter; never retries 400 or 404. - ]], - homepage = "https://cep.is", - license = "ISC", - labels = { "cep", "correios", "dne", "endereco", "brasil", "http" }, -} - -dependencies = { - "lua >= 5.1", - "luasocket >= 3.0", - "luasec >= 1.0", - "dkjson >= 2.5", -} - -build = { - type = "builtin", - modules = { - ["cepis"] = "cepis.lua", - ["cepis.client"] = "cepis/client.lua", - ["cepis.csv"] = "cepis/csv.lua", - ["cepis.errors"] = "cepis/errors.lua", - ["cepis.models"] = "cepis/models.lua", - }, - copy_directories = {}, -} - -test = { - type = "command", - command = "lua test/run.lua", -} -- cgit v1.3