-
Notifications
You must be signed in to change notification settings - Fork 332
Expand file tree
/
Copy pathorders.py
More file actions
71 lines (54 loc) · 2.48 KB
/
orders.py
File metadata and controls
71 lines (54 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import time
from datetime import datetime, timedelta
from ebaysdk.trading import Connection as Trading
from ebaysdk.poller import parse_args, file_lock
from ebaysdk import log
def sample():
pass
def main(opts):
with file_lock("/tmp/.ebaysdk-poller-orders.lock"):
log.debug("Started poller %s" % __file__)
to_time = datetime.utcnow() - timedelta(days=10)
from_time = to_time - timedelta(days=29)
ebay_api = Trading(debug=opts.debug, config_file=opts.yaml, appid=opts.appid,
certid=opts.certid, devid=opts.devid, siteid=opts.siteid, warnings=False
)
resp = ebay_api.execute('GetOrders', {
'DetailLevel': 'ReturnAll',
#'OrderStatus': 'Completed',
'Pagination': {
'EntriesPerPage': 25,
'PageNumber': 1,
},
'ModTimeFrom': from_time.strftime('%Y-%m-%dT%H:%M:%S.000Z'),
'ModTimeTo': to_time.strftime('%Y-%m-%dT%H:%M:%S.000Z'),
})
if resp.reply.OrderArray:
for order in resp.reply.OrderArray.Order:
log.debug("ID: %s" % order.OrderID)
log.debug("Status: %s" % order.OrderStatus)
log.debug("Seller Email: %s" % order.SellerEmail)
log.debug("Title: %s" % order.TransactionArray.Transaction.Item.Title)
log.debug("ItemID: %s" % order.TransactionArray.Transaction.Item.ItemID)
log.debug("SKU: %s" % order.TransactionArray.Transaction.Variation.SKU)
if order.ShippingDetails.get('ShipmentTrackingDetails', None):
log.debug("Tracking: %s" % order.ShippingDetails.ShipmentTrackingDetails.ShipmentTrackingNumber)
log.debug("Carrier: %s" % order.ShippingDetails.ShipmentTrackingDetails.ShippingCarrierUsed)
log.debug("Cost: %s" % order.ShippingDetails.ShippingServiceOptions.ShippingServiceCost)
else:
log.debug("no orders to process")
'''
- item title .. Title
- ebay auction Id .. ItemID
- seller id or alias ..
- seller email .. SellerEmail
- date of auction close
- ship tracking number
- cost of auction or transaction .. TransactionPrice
- shipping cost .. ActualShippingCost
- SKU .. SKU
- payment method and date
'''
if __name__ == '__main__':
(opts, args) = parse_args("usage: python -u -m ebaysdk.poller.orders [options]")
main(opts)