Hello,
I have the same issue with code 104 when i stream with python TwitterAPI.
Traceback (most recent call last):
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/site-packages/urllib3/response.py", line 437, in _error_catcher
yield
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/site-packages/urllib3/response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/http/client.py", line 461, in read
n = self.readinto(b)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/http/client.py", line 495, in readinto
return self._readinto_chunked(b)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/http/client.py", line 590, in _readinto_chunked
chunk_left = self._get_chunk_left()
File "/home/srg/anaconda3/envs/ai/lib/python3.7/http/client.py", line 558, in _get_chunk_left
chunk_left = self._read_next_chunk_size()
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/http/client.py", line 518, in _read_next_chunk_size
line = self.fp.readline(_MAXLINE + 1)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/ssl.py", line 929, in read
return self._sslobj.read(len, buffer)
ConnectionResetError: [Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/site-packages/TwitterAPI/TwitterAPI.py", line 373, in _iter_stream
buf += self.stream.read(1)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/site-packages/urllib3/response.py", line 541, in read
raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/contextlib.py", line 130, in __exit__
self.gen.throw(type, value, traceback)
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/site-packages/urllib3/response.py", line 455, in _error_catcher
raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/xxx/repos/2themoon/news-classifier/newsclassifier/websource/api/impl/twitter/v2.py", line 276, in producer_streaming
for line in stream:
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/site-packages/TwitterAPI/TwitterAPI.py", line 409, in __iter__
for item in self._iter_stream():
File "/home/xxx/anaconda3/envs/ai/lib/python3.7/site-packages/TwitterAPI/TwitterAPI.py", line 399, in _iter_stream
raise TwitterConnectionError(e)
TwitterAPI.TwitterError.TwitterConnectionError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))
Also when i try to stream using curl with bearer token:
$ curl -X GET -H "Authorization: Bearer $BEARER_TOKEN" "https://api.twitter.com/2/tweets/search/stream?tweet.fields=created_at&expansions=author_id&user.fields=created_at"
I receive the tweet but the connection is closed and throws this error with code 104:
{"data":{"id":"1398727721392521216","author_id":"806223543960825857","created_at":"2021-05-29T19:47:30.000Z","text":"a"},"includes":{"users":[{"name":"xxxx","id":"805223543961825857","created_at":"2016-12-06T19:47:26.000Z","username":"xxxx"}]},"matching_rules":[{"id":1398723584600329730,"tag":null}]}
curl: (56) OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 104
Thanks in advance!