From 80f973cb363f6fe938828172b4d756e923639187 Mon Sep 17 00:00:00 2001 From: Bruno Wagner Date: Mon, 15 Sep 2014 16:19:01 -0300 Subject: #47 The csv date is now parsed when importing messages, and will be used instead of the random one from before --- py-fake-service/app/adapter/mail.py | 7 ++----- py-fake-service/app/pixelated_user_agent.py | 1 + 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 . 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 -- cgit v1.2.3