Skip to content

Instantly share code, notes, and snippets.

@ziggy42
Created November 26, 2016 18:02
Show Gist options
  • Select an option

  • Save ziggy42/40ee995dc400eb01fdebec4e6e0b8e39 to your computer and use it in GitHub Desktop.

Select an option

Save ziggy42/40ee995dc400eb01fdebec4e6e0b8e39 to your computer and use it in GitHub Desktop.
Send random tweets
import tweepy
from time import sleep
from random import choice
from string import ascii_uppercase
from sys import argv
CONSUMER_KEY = ""
CONSUMER_SECRET = ""
ACCESS_TOKEN = ""
ACCESS_TOKEN_SECRET = ""
def get_random_string():
return ''.join(choice(ascii_uppercase) for i in range(12))
def send_random_tweet(api):
random_string = get_random_string()
print("Sending " + random_string)
api.update_status(random_string)
if __name__ == "__main__":
auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
api = tweepy.API(auth)
for i in range(int(argv[1])):
send_random_tweet(api)
sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment