I'm working on a Flask application that communicates with Amazon's MWS API. One of my functions sends XML feeds to post data on Amazon. It works fine at first, but after if I try to send a second request, I am getting the error 'str' object has no attribute 'SubmitFeedResult.' If stop the application and run it again, it works fine again. I'm getting the error on 'feed.SubmitFeedResult...' (see below). Any reason why this would change to a string? I'm a little confused as to why it works on the first request and doesn't work on another.
conn = connection.MWSConnection(aws_access_key_id=MWS_ACCESS_KEY,
aws_secret_access_key=MWS_SECRET_KEY, Merchant=MERCHANT_ID)
feed = conn.submit_feed(
FeedType=feed_operation(file_name),
PurgeAndReplace=False,
MarketplaceIdList=[MARKETPLACE_ID],
content_type='text/xml',
FeedContent=feed_content)
#Store feed info in database so it can be retrieved in the future
feed_data = FeedResult(
id = feed.SubmitFeedResult.FeedSubmissionInfo.FeedSubmissionId,
feed_type = feed.SubmitFeedResult.FeedSubmissionInfo.FeedType,
date = feed.SubmitFeedResult.FeedSubmissionInfo.SubmittedDate)
session.add(feed_data)
session.commit()
feed_info = feed.SubmitFeedResult.FeedSubmissionInfo.FeedSubmissionId
I was able to figure this out. I called out 'feed_info' as a string a few lines later to flash the ID, which was causing it to give me an error.