From d33a61601feee54cb2b2396fdcbebcd9fc224124 Mon Sep 17 00:00:00 2001 From: Denis Pitkov Date: Tue, 28 Mar 2023 15:33:47 +0300 Subject: [PATCH] Fix issues #11 --- account_generator_helper/__init__.py | 2 +- .../temp_mail/gmailnator/__init__.py | 2 +- account_generator_helper/temp_mail/gmailnator/letter.py | 9 ++++++--- account_generator_helper/temp_mail/inboxkitten/letter.py | 2 +- account_generator_helper/temp_mail/tempmail/letter.py | 2 +- setup.py | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/account_generator_helper/__init__.py b/account_generator_helper/__init__.py index 0d1dfcb..547c920 100644 --- a/account_generator_helper/__init__.py +++ b/account_generator_helper/__init__.py @@ -9,4 +9,4 @@ __author__ = 'Dionis1902' __email__ = 'den70007.ua@gmail.com' -__version__ = '1.0.13' +__version__ = '1.0.14' diff --git a/account_generator_helper/temp_mail/gmailnator/__init__.py b/account_generator_helper/temp_mail/gmailnator/__init__.py index b435aec..890e13c 100644 --- a/account_generator_helper/temp_mail/gmailnator/__init__.py +++ b/account_generator_helper/temp_mail/gmailnator/__init__.py @@ -58,6 +58,6 @@ def get_inbox(self): r = self._s.post('https://www.emailnator.com/message-list', headers={**headers, 'x-xsrf-token': self.__get_xsrf_token()}, data=payload) if r.status_code == 200: - return [Letter(self._email, _letter, self._proxies, self.__get_xsrf_token(), self._s) for _letter in r.json()['messageData'] if + return [Letter(self._email, _letter, self.__get_xsrf_token(), self._s) for _letter in r.json()['messageData'] if 'ADS' not in _letter['messageID']] return [] diff --git a/account_generator_helper/temp_mail/gmailnator/letter.py b/account_generator_helper/temp_mail/gmailnator/letter.py index a63ffa2..1918ee2 100644 --- a/account_generator_helper/temp_mail/gmailnator/letter.py +++ b/account_generator_helper/temp_mail/gmailnator/letter.py @@ -11,11 +11,14 @@ class Letter(letter.Letter): - def __init__(self, to, content, proxies, token, session): + def __init__(self, to, content, token, session): self._token = token self._s = session - letter_id, _from, subject = content['messageID'], content['from'], content['subject'] - super().__init__(to, *re.findall(r'(.*) <(.*)>', _from)[0], subject, datetime.fromtimestamp(0), proxies, letter_id) + if '<' in content['from']: + name, from_email = re.findall(r'^(.*) <(.*)>$', content['from'])[0] + else: + name = from_email = content['from'] + super().__init__(to, name, from_email, content['subject'], datetime.fromtimestamp(0), content['messageID']) @property def letter(self): diff --git a/account_generator_helper/temp_mail/inboxkitten/letter.py b/account_generator_helper/temp_mail/inboxkitten/letter.py index 76bb994..616191d 100644 --- a/account_generator_helper/temp_mail/inboxkitten/letter.py +++ b/account_generator_helper/temp_mail/inboxkitten/letter.py @@ -6,7 +6,7 @@ class Letter(letter.Letter): def __init__(self, url, headers, timestamp, session): if '<' in headers['from']: - name, from_email = re.findall(r'(.*) <(.*)>', headers['from'])[0] + name, from_email = re.findall(r'^(.*) <(.*)>$', headers['from'])[0] else: name = from_email = headers['from'] super().__init__(headers['to'], name, from_email, headers['subject'], datetime.fromtimestamp(timestamp)) diff --git a/account_generator_helper/temp_mail/tempmail/letter.py b/account_generator_helper/temp_mail/tempmail/letter.py index 4452959..ae87ac3 100644 --- a/account_generator_helper/temp_mail/tempmail/letter.py +++ b/account_generator_helper/temp_mail/tempmail/letter.py @@ -7,7 +7,7 @@ class Letter(letter.Letter): def __init__(self, to, from_email, subject, timestamp, body): if '<' in from_email: - name, from_email = re.findall(r'(.*) <(.*)>', from_email)[0] + name, from_email = re.findall(r'^(.*) <(.*)>$', from_email)[0] else: name = from_email = from_email diff --git a/setup.py b/setup.py index e504f65..93275d0 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='account_generator_helper', - version='1.0.13', + version='1.0.14', packages=find_packages(), classifiers=[ 'Development Status :: 3 - Alpha',