It returns several errors and most of them show: <framework not available>
I'm new at coding and I'm just trying making a bot for fun with the Twitter API but had a lot of errors and I don't know what to do.
The main error that appears is this one:
(from collections import namedtuple, Mapping ImportError: cannot import name 'Mapping' from 'collections')
can someone help me please?
import tweepy
# Authenticate to Twitter
auth = tweepy.OAuthHandler("", "")
auth.set_access_token("", "")
api = tweepy.API(auth)
# Pegar ID do bot
bot_id = int(api.me().id_str)
class MyStreamListener(tweepy.StreamListener):
def on_status(self, tweet):
print("tweet encontrado!")
print(f"TWEET: {tweet.author.scream_name} - {tweet.text}")
if tweet.author.id != bot_id and tweet.in_reply_to_status_id is None:
if not tweet.retweeted:
try:
print("Tentando retuite...")
api.retweet(tweet.id)
print("Retuitado com sucesso!")
except Exception as err:
print(err)
stream_listener = MyStreamListener()
stream = tweepy.Stream(auth=api.auth, Listener=stream_listener)
stream.filter(track=['Squirrel', 'Squirrels', 'squirrel', 'squirrels', 'Esquilo', 'Esquilos'], languages=['en', 'pt'])
The erros that appeers: Traceback (most recent call last): File "C:\Users\wgama\PycharmProjects\botesquilo\botesquilo.py", line 1, in import tweepy File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\tweepy_init_.py", line 12, in from tweepy.api import API File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\tweepy\api.py", line 15, in import requests File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\requests_init_.py", line 43, in import urllib3 File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3_init_.py", line 8, in from .connectionpool import ( File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connectionpool.py", line 29, in from .connection import ( File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\connection.py", line 39, in from .util.ssl_ import ( File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util_init_.py", line 3, in from .connection import is_connection_dropped File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\connection.py", line 3, in from .wait import wait_for_read File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\wait.py", line 1, in from .selectors import ( File "C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\site-packages\urllib3\util\selectors.py", line 14, in from collections import namedtuple, Mapping ImportError: cannot import name 'Mapping' from 'collections' (C:\Users\wgama\AppData\Local\Programs\Python\Python310\lib\collections_init_.py)