-
Notifications
You must be signed in to change notification settings - Fork 0
/
Twitter-name-changer.py
35 lines (28 loc) · 1.16 KB
/
Twitter-name-changer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import tweepy
import os
def create_api():
consumer_key=os.getenv('consumer_key')
consumer_secret=os.getenv('consumer_secret')
access_token=os.getenv('access_token')
access_token_secret=os.getenv('access_token_secret')
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth,wait_on_rate_limit=True,wait_on_rate_limit_notify=True)
api.verify_credentials()
print('API created')
return api
# Complete code
import time
def follower_count(user):
emoji_numbers = {0: "0️⃣", 1: "1️⃣", 2: "2️⃣", 3: "3️⃣",
4: "4️⃣", 5: "5️⃣", 6: "6️⃣", 7: "7️⃣", 8: "8️⃣", 9: "9️⃣"}
uf_split = [int(i) for i in str(user.followers_count)]
emoji_followers = ''.join([emoji_numbers[j] for j in uf_split if j in emoji_numbers.keys()])
return emoji_followers
api = create_api()
while True:
user = api.get_user('Rakesh33005029')
api.update_profile(name=f'Rakesh|{follower_count(user)} Followers')
print(f'Updating Twitter Name : Rakesh|{follower_count(user)} Followers')
print('Waiting to refresh')
time.sleep(60)