How to add a custom tweet to Tumblr API?

时间:2015-07-28 22:13:08

标签: python twitter tumblr pytumblr

I have the following code to post a blog on Tumblr through Tumblr API.

 post = client.create_text("xxx.tumblr.com",
                                      state="published",
                                      tags=utag_list,
                                      format='html',
                                      tweet=tweet.encode('utf-8'),
                                      slug=sluged_header,
                                      title=news.head_line.encode('utf-8'),
                                      body=body)

Strangely the tweet parameter doesnt do anything.

Looking at my blog source, I can see:

<li><a href="https://twitter.com/intent/tweet?text=Teenagers%20rescue%20elderly%20couple%20from%20sinking%20after%20car%20crashes%20into%20lake%20-%20Teenage%20wind-surfing...%20http%3A%2F%2Ftmblr.co%2FZ_F3uj1qlCL9u" class="share-item twitter" target="_blank">Tweet</a></li>

This is the default tweet message generated. Somehow my custom tweet message is completely ignored. And not generated in source. Hence the tweet sharing doesn't see the custom message. Any advice please?

1 个答案:

答案 0 :(得分:1)

我找到了解决方案。之所以发生这种情况,是因为推文略超过140个字符而被忽略而没有引发任何进一步的例外。

这个错误由​​Tumblr团队confirmed提出,并将在内部提出并修复。

同时确保推文比140个字符低100%。