Created
July 9, 2020 16:48
-
-
Save echohtp/2716c6dd8acef226723233932169ea99 to your computer and use it in GitHub Desktop.
Easy update twitter username w/ followers count
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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