Add range selection ability

The original implementation could only search for items that end in a specific date range
This makes it so that we can select between a start range, modified range, or the default end range

The override could probably use some work as there is currently nothing checking sellerList for any other types and there can only be one
This commit is contained in:
David Todd 2016-03-23 13:45:28 -05:00
parent 5045f1efd1
commit 0394f2c2b8
No known key found for this signature in database
GPG Key ID: 48E847F18074C953
1 changed files with 16 additions and 1 deletions

17
ebay.py
View File

@ -247,8 +247,23 @@ def glue(api, sellerList, dateRange={}):
# Override the dates in sellerList with values from dateRange, if provided
if ('from' in dateRange) & ('type' in dateRange):
# Remove the list of keys from sellerList - We can only have one search range
for o in ['EndTimeFrom','ModTimeFrom','StartTimeFrom']:
try:
del sellerList[o]
except KeyError:
continue
sellerList[rangeType(dateRange['type'])+'TimeFrom'] = dateRange['from']
if ('to' in dateRange) & ('type' in dateRange):
# Remove the list of keys from sellerList - We can only have one search range
for o in ['EndTimeTo','ModTimeTo','StartTimeTo']:
try:
del sellerList[o]
except KeyError:
continue
sellerList[rangeType(dateRange['type'])+'TimeTo'] = dateRange['to']
@ -280,7 +295,7 @@ try:
# Example usage, returns a dict containing all items of interst (based on the functions above)
itemData = glue(api=api, sellerList={}, dateRange={'from':today, 'to': '2016-05-26T23:59:59.999Z', 'type': 'end'})
# Store the itemIDs so that we can use them to check which ones were modified
itemlist = []
for i in itemData: