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

Portando código do python 2 para 3 #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

willianrocha
Copy link

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

from dhl_gm import DhlGmTracker
from packtrack.correios import EncomendaRepository
from packtrack.royal import RoyalMail
from packtrack.dhl_gm import DhlGmTracker
Copy link
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.

@@ -15,7 +15,7 @@ def get(self, numero, auth=None):
return func(numero, **kwargs)

def _init_scraper(self, backend):
from scraping import CorreiosWebsiteScraper, CorreiosRastroService
from packtrack.scraping import CorreiosWebsiteScraper, CorreiosRastroService
Copy link
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.

@@ -50,7 +49,7 @@ def get_encomenda_info(self, numero):

if html:
try:
html = html.decode('latin-1')
html = html.encode('latin-1')
Copy link
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.

.travis.yml Outdated
@@ -1,5 +1,8 @@
language: python

python:
- "3.6"
Copy link
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
Owner

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

@pbalduino
Copy link
Collaborator

pbalduino commented Dec 10, 2017 via email

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