Skip to content

Instantly share code, notes, and snippets.

@kjaymiller
Last active October 4, 2019 22:26
Show Gist options
  • Save kjaymiller/1525dc3d87079c491f8891f38210443c to your computer and use it in GitHub Desktop.
Save kjaymiller/1525dc3d87079c491f8891f38210443c to your computer and use it in GitHub Desktop.
Podcast Marketing Scripts
import requests
def publish_to_facebook_page(
message,
link,
*,
access_token,
page_id,
publish_datetime=None,
published=False,
):
"""
Shares your post to a facebook_page. Your page access token must have manage_pages and publish_pages permissions.
more on that at https://developers.facebook.com/docs/pages/access-tokens
"""
url = f'https://graph.facebook.com/{page_id}/feed?
params = {
'access_token': access_token,
'published': str(published).lower(),
'message': message,
'link': link,
}
# Published must be false if you are going to schedule something
if scheduled_publish_time and published == False:
params['scheduled_publish_time': publish_datetime'
return requests.post(url, params=params)
import tweepy
import os
public_key = os.environ['TWITTER_PUBLIC_KEY']
secret_key = os.environ['TWITTER_SECRET_KEY']
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
api.update_status()
for media in media_files:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment