Comments (5)
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
from twitterbot2.
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).
from twitterbot2.
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...
from twitterbot2.
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
from twitterbot2.
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..
from twitterbot2.
Related Issues (20)
- JS and CSS served as static files HOT 1
- Update dashboard HOT 1
- Chart width set by a slider HOT 1
- Add NavBar HOT 1
- Increase mobile width HOT 1
- Set correct chart width when refresh
- Chart always centered HOT 1
- Data Visualization errors correct handling HOT 1
- Fill the Wiki HOT 1
- Add uptime and status info HOT 1
- Logger error HOT 4
- Retweeting my own retweets HOT 6
- Adding more keywords and choose to fav and retweet HOT 8
- Unable to run any search HOT 3
- Add api endpoints HOT 2
- ValueError: Unrecognised argument(s): encoding
- Please contact me HOT 1
- Send a telegram message when the bot dies
- Create API documentation page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twitterbot2.