Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception para entradas vazias #2

Open
hopugop opened this issue Sep 6, 2012 · 0 comments
Open

Exception para entradas vazias #2

hopugop opened this issue Sep 6, 2012 · 0 comments

Comments

@hopugop
Copy link

hopugop commented Sep 6, 2012

O meu código de rastreamento acabou de ser liberado e como era de se esperar, o sistema dos Correios ainda não foi atualizado. No entanto, o código retorna um erro ao tentar iterar pelas colunas da tabela (nesse caso inexistente na página) e o script falha. Seria possível adicionar uma excpetion para tratamendo de casos onde a tabela é inexistente?

>>> encomenda = Correios.encomenda("DF118370137BR")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/correios_api_py-0.1.1-py2.7.egg/correios/__init__.py", line 9, in encomenda
    return Correios.encomenda_repository.get(numero)
  File "/usr/lib/python2.7/site-packages/correios_api_py-0.1.1-py2.7.egg/correios/correios.py", line 8, in get
    return self.correios_website_scraper.get_encomenda_info(numero)
  File "/usr/lib/python2.7/site-packages/correios_api_py-0.1.1-py2.7.egg/correios/scraping.py", line 20, in get_encomenda_info
    [encomenda.adicionar_status(status) for status in self._get_all_status_from_html(html)]
  File "/usr/lib/python2.7/site-packages/correios_api_py-0.1.1-py2.7.egg/correios/scraping.py", line 25, in _get_all_status_from_html
    table = html_info.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
>>> print encomenda.numero
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'encomenda' is not defined
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

No branches or pull requests

1 participant