简体   繁体   English

使用Python将图片发布到Facebook

[英]Post picture to Facebook using Python

如何使用Python将图像发布到Facebook?

You can use the facebook provided Python SDK to upload photos using an oauth key. 您可以使用Facebook提供的Python SDK使用oauth键上传照片。
Once you get the oauth key, you can upload a picture with GraphAPI.put_object() : 获得oauth密钥后,您可以使用GraphAPI.put_object()上传图片:

graph = facebook.GraphAPI(oauth_access_token)
photo = open("picture.jpg", "rb")
graph.put_object("me", "photos", message="You can put a caption here", source=photo.read())
photo.close()

Unfortunately, the Python SDK is discontinued now. 不幸的是,Python SDK现已停止使用。 Will not work. 不管用。 Need to use Javascript / PHP / iOS / Android APIs 需要使用Javascript / PHP / iOS / Android API

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM