I am using this api to access amazon mws. I want to fetch the Product code attached to a particular Order Id.
I create a list of 100 order ids and in a for loop try to fetch the Product Codes. But halfway through it gives me an error:
My Code:
from mws import mws
auth = mws.Orders(access_key=access_key,secret_key=secret_key,account_id=account_id, region='IN')
oid = [] ### a list of 100 or so order ids.
for id in oid:
item_detail = auth.list_order_items(id)
item_text = item_detail.original
file = open('order_details.xml','a')
file.write(item_text)
file.close()
Error is :
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='mws.amazonservices.in', port=443): Max retries exceeded with url: /Orders/2013-09-01?AWSAccessKeyId=DWAKIAJDWHSXML4XJT7NVLAQ&Action=ListOrderItems&AmazonOrderId=403-4521860-8323545&SellerId=A3AZIDWDQXFUT4SLU02M7&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2015-06-09T10%3A20%3A45Z&Version=2013-09-01&Signature=IInO1WBi2srQP5q8lTDgTMq%2BvKGrMqCxUqj56/bUYQQ%3D (Caused by <class 'socket.error'>: [Errno 111] Connection refused)
Access Key & Seller Id changed in Error
The error thrown is
Max retries exceeded
. So probably you are exceeded the amount of request you can do. It can help to build a sleep-timer in your code (10/100 ms or so, just experiment with it). Another option is to separate youroid
into different lists, and try it on different moments.