Forked from echohtp/twitter_update_username_w_followers.py
Created
July 9, 2020 18:55
-
-
Save hackingbutlegal/26091364776b66b5c0905b614e608cd2 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