mirror of
https://github.com/c0de-archive/ebay-testing.git
synced 2024-12-22 12:42:41 +00:00
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:
parent
5045f1efd1
commit
0394f2c2b8
17
ebay.py
17
ebay.py
@ -247,8 +247,23 @@ def glue(api, sellerList, dateRange={}):
|
|||||||
|
|
||||||
# Override the dates in sellerList with values from dateRange, if provided
|
# Override the dates in sellerList with values from dateRange, if provided
|
||||||
if ('from' in dateRange) & ('type' in dateRange):
|
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']
|
sellerList[rangeType(dateRange['type'])+'TimeFrom'] = dateRange['from']
|
||||||
|
|
||||||
if ('to' in dateRange) & ('type' in dateRange):
|
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']
|
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)
|
# 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'})
|
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
|
# Store the itemIDs so that we can use them to check which ones were modified
|
||||||
itemlist = []
|
itemlist = []
|
||||||
for i in itemData:
|
for i in itemData:
|
||||||
|
Loading…
Reference in New Issue
Block a user