Skip to content

Instantly share code, notes, and snippets.

@yrsegal
Created March 4, 2015 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yrsegal/153aca5141744835a0f8 to your computer and use it in GitHub Desktop.
Save yrsegal/153aca5141744835a0f8 to your computer and use it in GitHub Desktop.
import shitpost
import tweepy
import time
import json
import os
import sys
TWITTER_CONSUMER_KEY = ""
TWITTER_CONSUMER_SECRET = ""
TWITTER_ACCESS_KEY = ""
TWITTER_ACCESS_SECRET = ""
auth = tweepy.OAuthHandler(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET)
auth.set_access_token(TWITTER_ACCESS_KEY, TWITTER_ACCESS_SECRET)
api = tweepy.API(auth)
def main():
path = os.path.dirname(sys.argv[0])
while True:
config = json.load(open(os.path.join(path, "shitpostconfig.json")))
text = shitpost.generate(debug=True)
print(text)
print(" ")
api.update_status(text)
slept = 0
while slept < config["time"]:
config = json.load(open(os.path.join(path, "shitpostconfig.json")))
if not slept % config["notifytime"] and slept != 0: print("Slept "+str(slept)+" seconds.")
time.sleep(1)
slept += 1
if __name__ == "__main__": main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment