diff --git a/modules/aum/browser.py b/modules/aum/browser.py index 7d96a78b76e81080351bef9a32aed62968c1fb48..a3f1c1b02876dfdb4e5c29201bfa033b5b24e7c4 100644 --- a/modules/aum/browser.py +++ b/modules/aum/browser.py @@ -154,9 +154,9 @@ def build_request(self, url, *args, **kwargs): headers = kwargs.setdefault('headers', {}) if 'applications' not in url: today = local2utc(datetime.now()).strftime('%Y-%m-%d') - token = sha256(self.username + self.APITOKEN + today).hexdigest() + token = sha256((self.username + self.APITOKEN + today).encode('utf-8')).hexdigest() - headers['Authorization'] = 'Basic %s' % (b64encode('%s:%s' % (self.username, self.password))) + headers['Authorization'] = 'Basic %s' % (b64encode(b'%s:%s' % (self.username.encode('utf-8'), self.password.encode('utf-8')))).decode('utf-8') headers['X-Platform'] = 'android' headers['X-Client-Version'] = self.APIVERSION headers['X-AUM-Token'] = token @@ -181,8 +181,8 @@ def get_consts(self): return self.consts self.consts = [{}, {}] - for key, sexes in self.request('values').iteritems(): - for sex, values in sexes.iteritems(): + for key, sexes in self.request('values').items(): + for sex, values in sexes.items(): if sex in ('boy', 'both'): self.consts[0][key] = values if sex in ('girl', 'both'): diff --git a/modules/aum/contact.py b/modules/aum/contact.py index 0dbd56d66402675a7dd90220f0869742cf5b0623..98db46484b7d2030140461e956558c7a5e84ee7a 100644 --- a/modules/aum/contact.py +++ b/modules/aum/contact.py @@ -26,6 +26,7 @@ from weboob.capabilities.contact import Contact as _Contact, ProfileNode from weboob.tools.html import html2text +from weboob.tools.compat import unicode, basestring class FieldBase(object): @@ -242,7 +243,7 @@ def parse_profile(self, profile, consts): self.profile = OrderedDict() if 'sex' in profile: - for section, d in self.TABLE.iteritems(): + for section, d in self.TABLE.items(): flags = ProfileNode.SECTION if section.startswith('_'): flags |= ProfileNode.HEAD @@ -254,7 +255,7 @@ def parse_profile(self, profile, consts): s = ProfileNode(section, section.capitalize(), OrderedDict(), flags=flags) - for key, builder in d.iteritems(): + for key, builder in d.items(): try: value = builder.get_value(profile, consts[int(profile['sex'])]) except KeyError: diff --git a/modules/aum/module.py b/modules/aum/module.py index 195dc6756a694ad0340e8ba6db26c878f6610116..b94ac941a32517d52ca7e54562e6923f09c92bd5 100644 --- a/modules/aum/module.py +++ b/modules/aum/module.py @@ -36,6 +36,7 @@ from weboob.tools.value import Value, ValueBool, ValueBackendPassword from weboob.tools.date import local2utc from weboob.tools.misc import to_unicode +from weboob.tools.compat import unicode, long, basestring from .contact import Contact from .antispam import AntiSpam @@ -104,7 +105,7 @@ def iter_events(self): all_events[u'baskets'] = (self.browser.get_baskets, 'You were put into %s\'s basket') all_events[u'flashs'] = (self.browser.get_flashs, 'You sent a charm to %s') all_events[u'visits'] = (self.browser.get_visits, 'Visited by %s') - for type, (events, message) in all_events.iteritems(): + for type, (events, message) in all_events.items(): for event in events(): e = Event(event['who']['id']) @@ -343,7 +344,7 @@ def fill_contact(self, contact, fields): if 'profile' in fields: contact = self.get_contact(contact) if contact and 'photos' in fields: - for name, photo in contact.photos.iteritems(): + for name, photo in contact.photos.items(): if photo.url and not photo.data: data = self.browser.openurl(photo.url).read() contact.set_photo(name, data=data) diff --git a/tools/py3-compatible.modules b/tools/py3-compatible.modules index eb94dc43e1260c195f2f8d54284d4cb09dd281a4..d0e0156cb604cc9fe7cd39b0fb2888344e8bed78 100644 --- a/tools/py3-compatible.modules +++ b/tools/py3-compatible.modules @@ -14,6 +14,7 @@ anticaptcha amundi apec arte +aum avendrealouer axabanque bandcamp