diff options
author | Bruno Wagner <bwagner@thoughtworks.com> | 2014-09-15 16:19:01 -0300 |
---|---|---|
committer | Bruno Wagner <bwagner@thoughtworks.com> | 2014-09-15 16:19:27 -0300 |
commit | 80f973cb363f6fe938828172b4d756e923639187 (patch) | |
tree | 97dee1afcae9eec36496e187ee88225023cbb96b | |
parent | 3f158be0b30fa16dbc3ee7f60bd593e89bea1fb8 (diff) |
#47 The csv date is now parsed when importing messages, and will be used instead of the random one from before
-rw-r--r-- | py-fake-service/app/adapter/mail.py | 7 | ||||
-rw-r--r-- | py-fake-service/app/pixelated_user_agent.py | 1 | ||||
-rw-r--r-- | py-fake-service/requirements.txt | 1 |
3 files changed, 4 insertions, 5 deletions
diff --git a/py-fake-service/app/adapter/mail.py b/py-fake-service/app/adapter/mail.py index 5a298385..26c00277 100644 --- a/py-fake-service/app/adapter/mail.py +++ b/py-fake-service/app/adapter/mail.py @@ -16,7 +16,7 @@ from datetime import datetime import random import calendar - +from dateutil import parser class Mail: @@ -74,10 +74,7 @@ class Mail: headers['from'] = mbox_mail.get('From') or mbox_mail.from_addr headers['to'] = [mbox_mail.get('To')] headers['subject'] = mbox_mail.get('Subject') - headers['date'] = datetime.fromtimestamp( - random.randrange( - 1222222222, - self.NOW)).isoformat() + headers['date'] = parser.parse(mbox_mail['Date']).isoformat() headers['content_type'] = mbox_mail.get('Content-Type') return headers diff --git a/py-fake-service/app/pixelated_user_agent.py b/py-fake-service/app/pixelated_user_agent.py index 9b5d1e4e..73a6dc3a 100644 --- a/py-fake-service/app/pixelated_user_agent.py +++ b/py-fake-service/app/pixelated_user_agent.py @@ -13,6 +13,7 @@ # You should have received a copy of the GNU Affero General Public License # along with Pixelated. If not, see <http://www.gnu.org/licenses/>. from flask import Flask, request, Response, redirect +import os import csv import json import datetime diff --git a/py-fake-service/requirements.txt b/py-fake-service/requirements.txt index cb34951c..5dd57828 100644 --- a/py-fake-service/requirements.txt +++ b/py-fake-service/requirements.txt @@ -2,3 +2,4 @@ flask==0.10.1 scanner==0.0.5 requests==2.3.0 gunicorn==19.1.1 +python-dateutil |