How to send an image in direct message?

我与影子孤独终老i 提交于 2019-12-24 17:57:00

问题


I'm trying to send an image in direct message using python + tweepy but no luck. It showed as a link in incoming messages.

imgurl = 'https://t.co/***'
api.send_direct_message(screen_name='username',text=' '+imgurl)

Could you please advise? Official Twitter API doesn't shed a light for me as well.


回答1:


At the moment, you are sending a link. Literally a status message where the text is a URL.

Sadly, Twitter don't provide API access for uploading images via DM.

If you are able to use Twitter's private API, you should be able to attach a media_id to your DM. But other than that, you're out of luck.

Sorry.



来源:https://stackoverflow.com/questions/37345016/how-to-send-an-image-in-direct-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!