twikit
twikit copied to clipboard
“Event loop is closed” will be reported when failed to access twitter
version: 2.20
use asyncio , “Event loop is closed” will be reported when failed to access twitter
example:
async def get_latest_tweet(USER_ID, TYPE) -> Tweet:
tweets = await client.get_user_tweets(user_id=USER_ID, tweet_type=TYPE, count=10)
if tweets:
return tweets
return None
if __name__ == '__main__':
while True:
try:
asyncio.run(get_latest_tweet("1517030962764214272", "Tweets"))
except Exception as e:
print(e)
continue
sent full traceback please
and guy u need run this shit(get_latest_tweet) with one future