remove unused code
This commit is contained in:
@@ -70,23 +70,6 @@ class InvoiceGetter():
|
||||
mails_messages.extend(mail_list)
|
||||
return mail_list
|
||||
|
||||
# def downloadAllAttachmentsInInbox(self, imap):
|
||||
# typ, items = imap.search(None, '(SUBJECT "{}" SINCE "{}")'.format(INVOICE_SUBJECT_fr,
|
||||
# datetime.datetime.today().strftime(
|
||||
# date_format)))
|
||||
# items = items[0].split()
|
||||
# self.downloaAttachmentsInEmail(imap, "./")
|
||||
#
|
||||
# def downloaAttachmentsInEmail(self, imap, outputdir):
|
||||
# resp, data = imap.fetch(HERMES_INVOICE_EMAIL, "(BODY.PEEK[])")
|
||||
# email_body = data[0][1]
|
||||
# mail = email.message_from_string(email_body)
|
||||
# if mail.get_content_maintype() != 'multipart':
|
||||
# return
|
||||
# for part in mail.walk():
|
||||
# if part.get_content_maintype() != 'multipart' and part.get('Content-Disposition') is not None:
|
||||
# open(outputdir + '/' + part.get_filename(), 'wb').write(part.get_payload(decode=True))
|
||||
|
||||
def _get_messages_from_folder(self, imap, subject, folder="INBOX") -> list:
|
||||
imap.select(folder)
|
||||
mail_messages = []
|
||||
@@ -141,36 +124,7 @@ class InvoiceGetter():
|
||||
return mail_messages
|
||||
|
||||
|
||||
def clean(text):
|
||||
# clean text for creating a folder
|
||||
return "".join(c if c.isalnum() else "_" for c in text)
|
||||
|
||||
|
||||
def need_to_valid_url(url: str, successful_items) -> bool:
|
||||
if len(successful_items) == 0:
|
||||
return False
|
||||
print("url is :" + url)
|
||||
parts = url.split('/')
|
||||
id = parts[5]
|
||||
if len(id) == 6:
|
||||
for item in successful_items:
|
||||
# if item.url_validated is not None:
|
||||
# print("id:{}, status:{} ".format(id, str(item.url_validated)))
|
||||
if item.id == id:
|
||||
if item.url_validated is not None:
|
||||
return not item.url_validated
|
||||
else:
|
||||
# if url_validated is None
|
||||
return True
|
||||
# return True by default
|
||||
return False
|
||||
else:
|
||||
print("id not valid:{}".format(id))
|
||||
return False
|
||||
|
||||
|
||||
def get_invoices():
|
||||
# check time before start checking emails
|
||||
# get email address
|
||||
mail_list = MONGO_STORE_MANAGER.get_destination_emails()
|
||||
mail_list_to_check = []
|
||||
|
||||
Reference in New Issue
Block a user