Skip to content

Commit

Permalink
avoiding ratelimites
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhravya committed Mar 15, 2022
1 parent e8c99c6 commit c9c6337
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Binary file modified banner.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 2 additions & 8 deletions main.py
Expand Up @@ -24,7 +24,6 @@ def __login(self):
auth = tweepy.OAuthHandler(env["CONSUMER_KEY"], env["CONSUMER_SECRET"])
auth.set_access_token(env["ACCESS_TOKEN"], env["ACCESS_TOKEN_SECRET"])
api = tweepy.API(auth)
api.verify_credentials()
return api

def __get_latest_followers_images(self) -> list[io.BytesIO]:
Expand Down Expand Up @@ -81,17 +80,12 @@ def __update_banner(self) -> None:
self.__image_factory(savepath="banner.png")
self.client.update_profile_banner("banner.png")
print("Updated banner")
self.follower_len = self.__get_follower_len()

def __get_follower_len(self) -> int:
return len(self.client.get_followers(user_id=env.get("USER_ID")))

def update_every_few_minutes(self, minutes:int = 5):
"""Starts the update loop"""
while True:
if self.follower_len != self.__get_follower_len():
self.__update_banner()
time.sleep(60*minutes)
self.__update_banner()
time.sleep(60*minutes)

if __name__ == "__main__":
banner = ProfileBanner()
Expand Down

0 comments on commit c9c6337

Please sign in to comment.