Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChunkedEncodingError: ('Connection broken: IncompleteRead(x bytes read, x more expected)') #38

Open
eracle opened this issue Apr 21, 2022 · 2 comments

Comments

@eracle
Copy link

eracle commented Apr 21, 2022

Executing:

  url = "https://www.investing.com/instruments/HistoricalDataAjax"

  method = 'POST'
  data = params
  headers = head
  retries = 10
  hops = 3
  auth_data = None

  with tor_requests_session(hops, auth_data, retries=retries) as s:
      headers = dict(headers or [])
      request = Request(method, url, data=data, headers=headers)
      req = s.send(request.prepare())

Raises:

File /opt/conda/lib/python3.9/site-packages/torpy/http/requests.py:80, in do_request(url, method, data, headers, hops, auth_data, verbose, retries)
     78 request = Request(method, url, data=data, headers=headers)
     79 logger.warning('Sending: %s %s', request.method, request.url)
---> 80 response = s.send(request.prepare())
     81 logger.warning('Response status: %r', response.status_code)
     82 return response.text

File /opt/conda/lib/python3.9/site-packages/requests/sessions.py:687, in Session.send(self, request, **kwargs)
    684         pass
    686 if not stream:
--> 687     r.content
    689 return r

File /opt/conda/lib/python3.9/site-packages/requests/models.py:838, in Response.content(self)
    836         self._content = None
    837     else:
--> 838         self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
    840 self._content_consumed = True
    841 # don't need to release the connection; that's been handled by urllib3
    842 # since we exhausted the data.

File /opt/conda/lib/python3.9/site-packages/requests/models.py:763, in Response.iter_content.<locals>.generate()
    761         yield chunk
    762 except ProtocolError as e:
--> 763     raise ChunkedEncodingError(e)
    764 except DecodeError as e:
    765     raise ContentDecodingError(e)

ChunkedEncodingError: ('Connection broken: IncompleteRead(1593 bytes read, 5381 more expected)', IncompleteRead(1593 bytes read, 5381 more expected))
@eracle eracle changed the title ChunkedEncodingError: ('Connection broken: IncompleteRead(1593 bytes read, 5381 more expected)', IncompleteRead(1593 bytes read, 5381 more expected)) ChunkedEncodingError: ('Connection broken: IncompleteRead(x bytes read, x more expected)') Apr 21, 2022
@SorenJ89
Copy link

SorenJ89 commented Aug 5, 2022

Having the same issue now. Did you ever manage to find a solution?

@eracle
Copy link
Author

eracle commented Aug 6, 2022

No, I didn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants