feat: filtros de facetados via -f/--filtros - #10
Conversation
Agrega soporte para filtros de búsqueda con la sintaxis faceta:valor. - Nuevo argumento -f/--filtros en CLI: cuitonline -f personeria:juridica,iva:exento - search() y Busqueda() aceptan parámetro filtros opcional - _parsear_filtros() convierte 'key:val,key:val' a lista de params f5[] - _tipo_persona_desde_cuit() infiere tipo desde prefijo CUIT (30/33/34 → jurídica) - Sin filtros explícitos, mantiene el default persona:fisica (comportamiento anterior) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c0a0cdf4a1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| """Convierte 'personeria:juridica,iva:exento' en lista de (f5[], valor).""" | ||
| if not filtros: | ||
| return [("f5[]", "persona:fisica")] | ||
| return [("f5[]", f.strip()) for f in filtros.split(",")] |
There was a problem hiding this comment.
Preserve each facet's query parameter
For any non-persona facet, e.g. --filtros iva:iva_exento, CUIT Online's own facet links use a different parameter (f1[] for IVA, with other facets under f0/f2/f4/f6), but this parser always submits every user-provided filter as f5[]. As a result, the advertised IVA/ganancias/monotributo filters are not applied correctly; only tipo-persona filters can work. The parser needs to keep or infer the correct facet key instead of hard-coding f5[] for all filters.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Resuelto con el dict _FACETA_A_PARAM que mapea cada faceta a su parámetro correcto (iva→f1[], monotributo→f2[], ganancias→f3[], empleador→f4[], persona→f5[], nacionalidad→f6[]). Los mapeos se verifican con tests unitarios en TestParsearFiltros.
Closes #3
Cambios
-f/--filtrosen CLI:cuitonline gaitan -f persona:juridica,iva:iva_exentosearch()yBusqueda()aceptan parámetrofiltrosopcional_parsear_filtros()mapea cada faceta a su parámetro URL correcto (fN[]):iva→f1[],monotributo→f2[],ganancias→f3[]empleador→f4[],persona→f5[],nacionalidad→f6[]_extraer_tipo_persona()parsea "Persona Física/Jurídica" directamente del HTML (más confiable que inferir por prefijo CUIT)User-Agentheader para evitar 403 del sitiopersona:fisica