From 79e4628a53f1cac06f6426b301dafa1351412702 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Fri, 7 Mar 2014 11:16:21 +0200 Subject: Added timestamp datatype, more tests --- gsxws/objectify.py | 7 ++++++- gsxws/products.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'gsxws') diff --git a/gsxws/objectify.py b/gsxws/objectify.py index 3480b70..b37379c 100644 --- a/gsxws/objectify.py +++ b/gsxws/objectify.py @@ -84,7 +84,8 @@ def gsx_datetime(value): def gsx_timestamp(value): - return datetime.strptime(value, "%d-%b-%y %H:%M:%S") + # 03/06/14 09:01 PM + return datetime.strptime(value, "%m/%d/%y %H:%M %p") class GsxElement(objectify.ObjectifiedElement): @@ -126,6 +127,8 @@ class GsxElement(objectify.ObjectifiedElement): return gsx_price(result) if name.endswith('Date'): return gsx_date(result) + if name.endswith('Timestamp'): + return gsx_timestamp(result) if re.search(r'^[YN]$', result): return gsx_boolean(result) @@ -153,8 +156,10 @@ def parse(root, response): return root.find('*//%s' % response) + if __name__ == '__main__': import doctest import logging logging.basicConfig(level=logging.DEBUG) doctest.testmod() + diff --git a/gsxws/products.py b/gsxws/products.py index a9073d6..5b58a23 100644 --- a/gsxws/products.py +++ b/gsxws/products.py @@ -81,7 +81,7 @@ class Product(object): if date_received: self._gsx.unitReceivedDate = date_received - + self._gsx._submit("unitDetail", "WarrantyStatus", "warrantyDetailInfo") self.warrantyDetails = self._gsx._req.objects self.imageURL = self.warrantyDetails.imageURL @@ -186,7 +186,7 @@ class Product(object): @property def is_valid(self): - return self.is_iphone or self.is_ipad or self.is_mac + return self.is_ios or self.is_mac @property def has_warranty(self): -- cgit v1.2.3