0
此代碼執行錯誤:如何在循環中執行twitter.Api.PostUpdate?
# some constants and auth before, looks not important
topPosts = reddit.get_subreddit('funny').get_top(limit=3)
for post in topPosts:
twitter.PostUpdate(status = post.title, media = post.url)
控制檯日誌:
Traceback (most recent call last):
File "script.py", line 17, in <module>
twitter.PostUpdate(status = post.title, media = post.url)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twitter/api.py", line 990, in PostUpdate
media_additional_owners)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twitter/api.py", line 1132, in UploadMediaChunked
boundary = bytes("--{0}".format(uuid4()), 'utf-8')
TypeError: str() takes at most 1 argument (2 given)
如果我這樣做只是post.label
環路它完美的作品。
如果我只執行一個(W/O循環)PostUpdate
它完美的作品。
我認爲這是因爲PostUpdate
是異步的,但無法弄清楚如何解決它。請幫忙。