Skip to content

Portando código do python 2 para 3 - #13

Open
willianrocha wants to merge 3 commits into
aleborba:masterfrom
willianrocha:port-python3
Open

Portando código do python 2 para 3#13
willianrocha wants to merge 3 commits into
aleborba:masterfrom
willianrocha:port-python3

Conversation

@willianrocha

Copy link
Copy Markdown

Modificado a sintaxe dos imports
Modificado para bytes e strings ao longo do código
Atualizado requirements
BeautifulSoup agora pede um parser, utilizei o lxml por ser o sugerido pela documentaçao

Comment thread packtrack/__init__.py Outdated
from dhl_gm import DhlGmTracker
from packtrack.correios import EncomendaRepository
from packtrack.royal import RoyalMail
from packtrack.dhl_gm import DhlGmTracker

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usa imports relativos (from .correios import EncomendaRepository). Para isso, precisa do from __future__ import absolute_import no inicio do arquivo.

Comment thread packtrack/correios.py Outdated

def _init_scraper(self, backend):
from scraping import CorreiosWebsiteScraper, CorreiosRastroService
from packtrack.scraping import CorreiosWebsiteScraper, CorreiosRastroService

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mesma coisa, use import relativo.

Comment thread packtrack/scraping.py Outdated
if html:
try:
html = html.decode('latin-1')
html = html.encode('latin-1')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não tenho certeza se isso faz sentido.

Comment thread .travis.yml
language: python

python:
- "3.6"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Precisa também rodar no python 2.7.

removido encode latin-1 desnecessario
adicionado ao travis python 2.7
@aleborba

Copy link
Copy Markdown
Owner

@iurisilvio é OK fazer o merge? Minha preocupação é como isso pode refletir no postmon caso atualize tudo.

@pbalduino

pbalduino commented Dec 10, 2017 via email

Copy link
Copy Markdown
Collaborator

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.

4 participants