Skip to content

Instantly share code, notes, and snippets.

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 hackingbutlegal/26091364776b66b5c0905b614e608cd2 to your computer and use it in GitHub Desktop.
Save hackingbutlegal/26091364776b66b5c0905b614e608cd2 to your computer and use it in GitHub Desktop.
Easy update twitter username w/ followers count
import os
import tweepy
from flask import Flask
# Authenticate to Twitter
auth = tweepy.OAuthHandler("API KEY", "API SECRET")
auth.set_access_token("TOKEN", "SECRET")
# Create API object
api = tweepy.API(auth)
# Get my user object
iam = api.me()
# Get followers #
followers_count = iam.followers_count
# Update user name
api.update_profile(name="Jason Alvarez has {} followers".format(int(followers_count)))
# Spawn HTTP Server for Heroku
app = Flask(__name__)
app.run(os.environ.get('PORT'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment