hootsuiterestapi的python库。

hootsweet的Python项目详细描述


^{1}$ PyPI VersionsPyPi FormatRequirements StatusDocumentation Status

hootsuiterestapi的python API。在

安装

pip install hootsweet

使用

^{pr2}$

消息

token={"access_token":"e9a90a81-xf2d-dgh3-cfsd-23jhvn76","token_Type":"Bearer","expires_in":2592000,"refresh_token":"82d82cf4-76gf-gfds-nt3k-lzpo12jg","scope":"offline"}client=HootSweet("client_id","client_secret",token=token)# Schedule a messagetext="A message"social_profile_ids=["1234","12345"]send_time=datetime(2020,1,1,12,40,15)message=client.schedule_message(text=text,social_profile_ids=social_profile_ids,send_time=send_time)# Get messagemessage=client.get_message(message_id="98765")# Delete messageclient.delete_message(message_id="98765")

媒体消息

HootSuite使用自己的AWS存储桶向消息添加媒体。到 将媒体附加到您需要先上载媒体的邮件 去HootSuite的水桶。在

token={"access_token":"e9a90a81-xf2d-dgh3-cfsd-23jhvn76","token_Type":"Bearer","expires_in":2592000,"refresh_token":"82d82cf4-76gf-gfds-nt3k-lzpo12jg","scope":"offline"}client=HootSweet("client_id","client_secret",token=token)mime_type="image/png"file_path=Path("/path/to/file.png")file_size=file_path.stat().st_sizeupload_details=client.create_media_upload_url(file_size,mime_type)upload_url=upload_details["uploadUrl"]media_id=upload_details["id"]# The number of seconds you have to upload the mediaexpires_in=upload_details["uploadUrlDurationSeconds"]# Upload the mediawithfile_path.open("rb")asf:content=f.read()headers={"Content-Type":mime_type,"Content-Length":str(file_size)}# Make sure that this request returns a 200requests.put(upload_url,headers=headers,data=content)# Schedule a messagetext="A message"social_profile_ids=["1234","12345"]send_time=datetime(2020,1,1,12,40,15)media=[{"id":media_id}]message=client.schedule_message(text=text,social_profile_ids=social_profile_ids,send_time=send_time,media=media)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
API调用时返回java Null   JavaJAXB:如何从嵌套元素中检索文本属性?   java如何在Windows机器上用Maven创建Dockerfile,然后发送到远程Linux服务器以构建映像,然后运行?   并行处理集群java独立应用程序   java使用POST将图像上传到服务器   分发组的java JavaMail/Exchange AuthAs标头   swing Java JScrollPane多个组件   JAXB将XML文档映射到Java对象   java如何在JDK中实现OpenCSV CSVReader,我正在使用VSC代码   基于屏幕大小的java翻译动画   在java中比较堆栈元素和对象的搜索   java如何在Swing中更改化身?   java JAXB将1个XML标记映射到2个变量   java面试问题:递归生成素数的最快方法是什么?   JavaEclipseIDE频繁关闭   Java中从像素读取RGB值的图像   通过查询oracle DB列值获得的字符串中的java转义XML特殊字符   java从ArrayList中删除多个项