You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/geventhttpclient/connectionpool.py", line 158, in get_socket
return self._socket_queue.get(block=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "src/gevent/queue.py", line 335, in gevent._gevent_cqueue.Queue.get
File "src/gevent/queue.py", line 350, in gevent._gevent_cqueue.Queue.get
File "src/gevent/queue.py", line 319, in gevent._gevent_cqueue.Queue._Queue__get_or_peek
'''Return the approximate size of the queue (not reliable!).'''
_queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/hrequests/client.py", line 466, in execute_request
resp = self.server.post(
^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/geventhttpclient/client.py", line 277, in post
return self.request(METHOD_POST, request_uri, body=body, headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/geventhttpclient/client.py", line 233, in request
sock = self._connection_pool.get_socket()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/geventhttpclient/connectionpool.py", line 161, in get_socket
return self._create_socket()
^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/geventhttpclient/connectionpool.py", line 126, in _create_socket
raise first_error
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/geventhttpclient/connectionpool.py", line 113, in _create_socket
sock = self._connect_socket(sock, sock_info[-1])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/geventhttpclient/connectionpool.py", line 134, in _connect_socket
sock.connect(address)
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/gevent/_socketcommon.py", line 590, in connect
self._internal_connect(address)
File "/opt/miniconda3/envs/scraper/lib/python3.11/site-packages/gevent/_socketcommon.py", line 634, in _internal_connect
raise _SocketError(err, strerror(err))
ConnectionRefusedError: [Errno 111] Connection refused
When running this locally, everything goes fine. It was also fine on the server for a few days, but at some point I got this error and I am not able to understand what goes wrong.
Any help is appreciated.
The text was updated successfully, but these errors were encountered:
Having the same issue.
Doesn't appear on every run, only sporadically. Happens with hrequests 0.9.1 and 0.9.2 on ubuntu Linux 5.4.0-200-generic #220-Ubuntu SMP Fri Sep 27 13:19:16 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Getting this error after 'import hrequests' (always some random characters after tcp/): HTTP server ListenAndServe: listen tcp: lookup tcp/`▒: invalid argument
Subsequent requests throw an error ConnectionRefusedError: [Errno 111] Connection refused
So I have been trying to solve the problem myself.
hrequests uses a server written in Go. As far as I can tell, the correct port number is passed to the server from python and I struggle to investigate the problem further. I tried different versions of python, updated all the Go libraries, but still get the same error, no matter what.
As a temporary workaround I managed to make it work from a Docker container (consistently, as far as I can tell)
cat Dockerfile
# Use an official Python image with the desired version
FROM python:3.11-slim
# Install necessary system dependencies
RUN apt-get update && apt-get install -y \
gcc \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip setuptools wheel \
&& pip install --no-cache-dir hrequests
# Set the default command to run your script
CMD ["python", "scrape.py"]
Hello everyone,
I am having issues to use the hrequests package on my server.
When running
I get the following warning:
Then when I run the follwing code (I just changed the website api url):
I get the following error
When running this locally, everything goes fine. It was also fine on the server for a few days, but at some point I got this error and I am not able to understand what goes wrong.
Any help is appreciated.
The text was updated successfully, but these errors were encountered: