Skip to content

Instantly share code, notes, and snippets.

@timothyclemansinsea
Created December 18, 2016 05:44
Show Gist options
  • Save timothyclemansinsea/79bd6ae9194c835ab66c4fa17c076dd1 to your computer and use it in GitHub Desktop.
Save timothyclemansinsea/79bd6ae9194c835ab66c4fa17c076dd1 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Original script (kept up to date): https://github.com/robincamille/bot-tutorial/blob/master/mybot.py
# Twitter Bot Starter Kit: Bot 1
# This bot tweets three times, waiting 15 seconds between tweets.
# If you haven't changed credentials.py yet with your own Twitter
# account settings, this script will tweet at twitter.com/lacunybot
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
ACCESS_TOKEN = ''
ACCESS_SECRET = ''
# Housekeeping: do not edit
import tweepy, time
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_SECRET)
api = tweepy.API(auth)
from communityapis.sites.patreon_com import get_patreon_project_stats
last = None
while True:
if not last:
last = get_patreon_project_stats('becomingdatasci')
continue
current = get_patreon_project_stats('becomingdatasci')
if last != current:
line = "Monthly pledges are now $%s total from %s patrons. Please donate and encourage your data science buddies to donate." % (int(current['pledge_sum']), current['patron_count'])
api.update_status(line)
last = current
time.sleep(60)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment