'Python script to post a picture with text on a facebook wall
As the title says. Is it possible to write a Python script that posts a jpg picture on a facebook wall along with a text string? If it is possible. How do I start?
Best regards.
Solution 1:[1]
You can do it with Facebook Graph API
You can find documentation for posting text and an attachment on a wall here. Make sure to authenticate a user first though. You can find the documentation on the same page
The code will then look pretty simple:
import facebook
graph = facebook.GraphAPI(access_token='your_token')
attachment = {
'name': 'Link name'
'link': 'http://www.example.com/',
'caption': 'Check out this example',
'description': 'This is a longer description of the attachment',
'picture': 'http://www.example.com/thumbnail.jpg'
}
graph.put_wall_post(message='Check this out...', attachment=attachment)
Solution 2:[2]
You can do with POST :
curl -i -X POST "https://graph.facebook.com/ID_PAGE/photos?
url=URL_PICTURE
&message="YOUR_MESSAGE"
&access_token=YOUR_ACCESS_TOKEN"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Aupire |
