|
@@ -17,7 +17,6 @@ from bs4 import BeautifulSoup
|
17
|
17
|
from email_reply_parser import EmailReplyParser
|
18
|
18
|
|
19
|
19
|
from tracim.lib.base import logger
|
20
|
|
-from tracim.controllers.events import VALID_TOKEN_VALUE
|
21
|
20
|
|
22
|
21
|
TRACIM_SPECIAL_KEY_HEADER = "X-Tracim-Key"
|
23
|
22
|
BS_HTML_BODY_PARSE_CONFIG = {
|
|
@@ -168,7 +167,7 @@ class MailFetcher(object):
|
168
|
167
|
|
169
|
168
|
def __init__(self,
|
170
|
169
|
host: str, port: str, user: str, password: str, folder: str,
|
171
|
|
- delay: int, endpoint: str) \
|
|
170
|
+ delay: int, endpoint: str, token:str) \
|
172
|
171
|
-> None:
|
173
|
172
|
"""
|
174
|
173
|
Fetch mail from a mailbox folder through IMAP and add their content to
|
|
@@ -181,6 +180,7 @@ class MailFetcher(object):
|
181
|
180
|
:param folder: mail folder where new mail are fetched
|
182
|
181
|
:param delay: seconds to wait before fetching new mail again
|
183
|
182
|
:param endpoint: tracim http endpoint where decoded mail are send.
|
|
183
|
+ :param token: token to authenticate http connexion
|
184
|
184
|
"""
|
185
|
185
|
self._connection = None
|
186
|
186
|
self._mails = []
|
|
@@ -191,6 +191,7 @@ class MailFetcher(object):
|
191
|
191
|
self.folder = folder
|
192
|
192
|
self.delay = delay
|
193
|
193
|
self.endpoint = endpoint
|
|
194
|
+ self.token = token
|
194
|
195
|
|
195
|
196
|
self._is_active = True
|
196
|
197
|
|
|
@@ -260,7 +261,7 @@ class MailFetcher(object):
|
260
|
261
|
unsended_mail = []
|
261
|
262
|
while self._mails:
|
262
|
263
|
mail = self._mails.pop()
|
263
|
|
- msg = {"token": VALID_TOKEN_VALUE,
|
|
264
|
+ msg = {"token": self.token,
|
264
|
265
|
"user_mail": mail.get_from_address(),
|
265
|
266
|
"content_id": mail.get_key(),
|
266
|
267
|
"payload": {
|