Skip to content
This repository was archived by the owner on Nov 16, 2024. It is now read-only.

Problema con las provincias #110

Open
abediaga opened this issue Nov 30, 2022 · 2 comments
Open

Problema con las provincias #110

abediaga opened this issue Nov 30, 2022 · 2 comments

Comments

@abediaga
Copy link

Hola,

A la hora de parsear el PDF de un BORME con bormeparser.parse da un error en las provincias de:
ALICANTE/ALACANT
CASTELLON/CASTELLO
VALENCIA/VALENCIA

Lo curioso es que en el caso de ARABA/ÁLAVA no da error.

¿Puede ser por la cláusula definida el "provincia.py" para Araba pero no para el resto de provincias?

def from_title(title):
try:
if title == 'ARABA/ÁLAVA':
return PROVINCIA.ALAVA
title = remove_accents(title).replace(' ', '_')
return getattr(PROVINCIA, title)
except AttributeError:
raise ValueError('InvalidProvince: %s' % title)

Un saludo.

@abediaga
Copy link
Author

He modificado provincia.py con el siguiente código y parece que funciona.

def from_title(title):
    try:
        if title == 'ARABA/ÁLAVA':
            return PROVINCIA.ALAVA
        elif title == 'ALICANTE/ALACANT':
            return PROVINCIA.ALICANTE
        elif title == 'CASTELLON/CASTELLO':
            return PROVINCIA.CASTELLON
        elif title == 'VALENCIA/VALENCIA':
            return PROVINCIA.VALENCIA
        title = remove_accents(title).replace(' ', '_')
        return getattr(PROVINCIA, title)
    except AttributeError:
        raise ValueError('InvalidProvvince: %s' % title)

@PabloCastellano
Copy link
Owner

Hola Aitor,

De vez en cuando la Agencia que publica los Boletines Oficiales decide hacer algunos cambios en el formato y este fue uno de ellos.

En cuanto a la solución, me parece correcta. Pull requests are welcome! 😃

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants