'str'对象没有属性'SubmitFeedResult'

编程入门 行业动态 更新时间:2024-10-24 10:26:23
本文介绍了'str'对象没有属性'SubmitFeedResult'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在开发一个与亚马逊MWS API通信的Flask应用程序。我的一个函数发送XML提要在Amazon上发布数据。它起初工作正常,但如果我尝试发送第二个请求后,我得到错误str对象没有属性SubmitFeedResult。如果停止应用程序并再次运行,它再次正常工作。我收到feed.SubmitFeedResult ...的错误(见下文)。任何原因,这将改变为一个字符串?我有点困惑,为什么它在第一个请求上工作,不工作在另一个。

conn = connection.MWSConnection(aws_access_key_id = MWS_ACCESS_KEY, aws_secret_access_key = MWS_SECRET_KEY,商家= MERCHANT_ID) Feed = conn.submit_feed( FeedType = feed_operation(file_name), PurgeAndReplace = False, MarketplaceIdList = [MARKETPLACE_ID], content_type ='text / xml' , FeedContent = feed_content) 在数据库中存储Feed信息,以便将来可以检索 feed_data = FeedResult( id = feed.SubmitFeedResult.FeedSubmissionInfo .FeedSubmissionId, feed_type = feed.SubmitFeedResult.FeedSubmissionInfo.FeedType, date = feed.SubmitFeedResult.FeedSubmissionInfo.SubmittedDate) session.add(feed_data) sessionmit() feed_info = feed.SubmitFeedResult.FeedSubmissionInfo.FeedSubmissionId

解决方案

我能弄明白这一点。我在几行后面的字符串中调用了'feed_info'来刷新ID,导致它给我一个错误。

flash('已提交产品Feed:'+ str(feed_info))

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) sessionmit() 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.

flash('Submitted Product Feed: ' + str(feed_info))

更多推荐

'str'对象没有属性'SubmitFeedResult'

本文发布于:2023-10-16 16:46:03,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   对象   str   SubmitFeedResult

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!