Created
September 2, 2016 19:40
-
-
Save sharoonthomas/d8bba71ea73c37f37dad3a06d45518a6 to your computer and use it in GitHub Desktop.
Get shipments from fulfil using API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
from datetime import date | |
from pprint import pprint | |
from fulfil_client import Client | |
client = Client('<subdomain>', os.environ['FULFIL_API_KEY']) | |
Shipment = client.model('stock.shipment.out') | |
def get_shipments(start_date, end_date): | |
"Return shipments between start and end date" | |
shipments = Shipment.search_read( | |
[ | |
('effective_date', '>=', start_date), | |
('effective_date', '<=', end_date), | |
('state', '=', 'done'), | |
], | |
None, # pagination/offset | |
None, # pagination/limit | |
None, # ordering | |
[ | |
'code', | |
'effective_date', | |
'customer.rec_name', | |
'delivery_address.country.name', | |
#'delivery_address.full_address', | |
'tracking_number.rec_name', | |
'order_numbers', | |
] | |
) | |
return shipments | |
if __name__ == '__main__': | |
shipments = get_shipments( | |
date(2016, 8, 1), | |
date(2016, 8, 30), | |
) | |
pprint(shipments) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pip install fulfil_client
best_buy.fulfil.io
, then the subdomain isbest_buy
.export FULFIL_API_KEY=REPLACETHISWITHYOURAPIKEY
python get_shipments.py