diff options
author | Filipp Lepalaan <filipp@mac.com> | 2014-03-07 11:16:21 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2014-03-07 11:16:21 +0200 |
commit | 79e4628a53f1cac06f6426b301dafa1351412702 (patch) | |
tree | ae04368811a29f30b1d8b9298abcfcd2cd471fbf /gsxws | |
parent | 187735f29c43e5356b8d153f7db82e05d2440d60 (diff) | |
download | py-gsxws-79e4628a53f1cac06f6426b301dafa1351412702.tar.gz py-gsxws-79e4628a53f1cac06f6426b301dafa1351412702.tar.bz2 py-gsxws-79e4628a53f1cac06f6426b301dafa1351412702.zip |
Added timestamp datatype, more tests
Diffstat (limited to 'gsxws')
-rw-r--r-- | gsxws/objectify.py | 7 | ||||
-rw-r--r-- | gsxws/products.py | 4 |
2 files changed, 8 insertions, 3 deletions
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): |