Open appnativeitalia opened 1 year ago
The error message [Errno 104] Connection reset by peer
makes me think to a server error.
Be sure your credentials are valid, for example try to authenticate using https://github.com/twitter/twurl
Non funziona. A volte l'errore "Connection reset..." scompare.
INFO:2023-05-17` 16:16:08,445 | Today tweets count: 0
INFO:2023-05-17 16:16:08,445 | Today likes count: 0
INFO:2023-05-17 16:16:08,445 | Today retweets count: 0
INFO:2023-05-17 16:16:08,446 | Followers count: 0
Ho provato questa soluzione https://github.com/twitterdev/Twitter-API-v2-sample-code/blob/main/User-Tweet-Timeline/user_tweets.py
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1092, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 635, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 774, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 459, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 503, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib64/python3.9/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib64/python3.9/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/lib64/python3.9/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 844, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/retry.py", line 470, in increment
raise reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.9/site-packages/urllib3/util/util.py", line 38, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 790, in urlopen
response = self._make_request(
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 491, in _make_request
raise new_e
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 467, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1092, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 635, in connect
sock_and_verified = _ssl_wrap_socket_and_match_hostname(
File "/usr/local/lib/python3.9/site-packages/urllib3/connection.py", line 774, in _ssl_wrap_socket_and_match_hostname
ssl_sock = ssl_wrap_socket(
File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 459, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname)
File "/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py", line 503, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/lib64/python3.9/ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "/usr/lib64/python3.9/ssl.py", line 1040, in _create
self.do_handshake()
File "/usr/lib64/python3.9/ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/tweep/test.py", line 57, in <module>
main()
File "/root/tweep/test.py", line 52, in main
json_response = connect_to_endpoint(url, params)
File "/root/tweep/test.py", line 38, in connect_to_endpoint
response = requests.request("GET", url, auth=bearer_oauth, params=params)
File "/usr/local/lib/python3.9/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.9/site-packages/requests/adapters.py", line 501, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
Il problema è che le api di Twitter mi sembra siano state aggiornate Ho provato anche con tweepy e ... nulla. Il tuo script mi sembrava più usabile perchè usa metodo differente. Come server ho usato installazioni vergini sia di Ubuntu 22 che Centos 11 Non ho toccato nulla a livello di impostazioni. Ripeto che le credenziali prelevate dal pannello developer di Twitter sono quelle non a pagamento (con permessi di scrittura e lettura).
non so che dirti, è ovvio che il problema è lato twitter, non il bot. Io sto nella tua stessa situazione: non pago, API gratuite e come vedi la demo runna senza problemi https://twitter.com/ai_testing.
Probabilmente devi abilitare qualcosa nelle impostazioni sviluppatore di Twitter? Onestamente non ne ho idea...
Ciao, grazie per la risposta. Ho appurato che l'errore è un 403 Sostanzialmente ho provato con altri script è riesco a twittare. Ma la ricerca e dunque l'accesso al resto delle api non funziona Il problema non è dello script, che è ben fatto, ma relativo all'aggiornamento delle api alla v.2
https://developer.twitter.com/en/docs/twitter-api/getting-started/about-twitter-api#item0
Infatti nella bacheca developer vedo 2 tab per le api v.2. Una è gratuita (free) e una a pagamento (basic) con costo di 100 al mese. Free features sono Tweets And User. Le Basic Features (100$) sono tutte le altre .... loockup, tweets, timeline, search etc.
Sinceramente non so perchè la tua funzioni. Forse perchè hai token vecchi? Ma sembra che da un mesetto le cose siano cambiate. Se hai buone notizie fammi sapere. Un saluto
ps. per ora mi arrendo
si credo che le ho da circa un anno e mezzo. Prova a cercare su internet se trovi qualche risorsa che spiega come usare la v1.1. magari sei fortunato..
Hello, first of all thanks for the work (I wrote to you last night)
1) I have tried countless times but no tweets, followers from message boards are being picked up. I tried both making new tweets a) on the manager account's wall and b) on the bot's wall. The two accounts (manager and bot) are linked. I entered all credentials as described in your guide.
Now,
This my example commands:
2) Also didn't understand if multiple users can be followed. I also did some tests by manually inserting new users into the database.db file.
3) In any case, in the globals.py file I have inserted the 2 connected twitter accounts. On the command line, the response is always thiS:
Thank, again, for the work