Skip to content

Conversation

@willidert
Copy link

@willidert willidert commented Apr 13, 2020

The geonames does not work for all CEPs in Brazil. I added a function that checks if the zip code is valid for geonames.

Closes #30

@rth
Copy link
Member

rth commented Apr 18, 2020

Thanks @willidert . We could add optional validation via the query_postal_code(..., validate=True) parameter, however it would need to be extensively tested to pass on all postal codes in the DB and fail on a few counter examples (see test_pgeocode.py for examples of test).

For now this is a 1 file package (pgeocode.py) with test_pgeocode.py for unit tests. So this PR should only change these two files.

To fix merge conflicts please use back see https://github.com/symerio/pgeocode/blob/master/doc/contributing.rst#code-style for more details.

@rth
Copy link
Member

rth commented Apr 18, 2020

Also if we want to do this check, the mechanism needs to be generic enough so it can be easily extended to other countries. Maybe something like,

class _CheckPostalCode:
    def __init__(self, country):
        self.country = country

    def __call__(self, postal_code):
        if self.country == "BR":
           ...
        else:
           raise NotImplementedError

@willidert
Copy link
Author

hi @rth , i've been a little busy, sorry. I'll make the changes. Thank you very much for the suggestions and support.

@willidert willidert closed this Oct 11, 2020
@willidert
Copy link
Author

Sorry, i have problems with github actions.

@willidert willidert reopened this Oct 11, 2020
@willidert willidert requested a review from rth October 11, 2020 23:17
@willidert
Copy link
Author

Thx for the opportunity, I hope it helped. I had a little difficulty in the tests. I'm sorry if something is strange. I am available for any correction.

@rth rth changed the title Issue 30 - trying solve Fix PC encoding for Brazil Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pgeocode not working for Brazil Z.P.

2 participants