python
pip install facebook-sdk
python
import facebook
app_id = 'YOUR_APP_ID'
app_secret = 'YOUR_APP_SECRET'
access_token = 'YOUR_ACCESS_TOKEN'
graph = facebook.GraphAPI(access_token=access_token, version='3.0')
python
def share_to_facebook(article_url, article_title, article_description):
attachment = {
'link': article_url,
'name': article_title,
'description': article_description,
}
graph.put_wall_post(message='Check out this article!', attachment=attachment)
python
article_url = 'https://example.com/article'
article_title = 'Awesome Article'
article_description = 'This article is great!'
share_to_facebook(article_url, article_title, article_description)