0

I am successfully able to send an HTTP GET request using Python 3.9. However, when attempting the same request using Django 4.2 and Python 3.10, it fails to work as expected.

import requests
headersa = {
            'accept': 'text/plain',
            'x-api-key': 'pgH7QzFHJx4w46fI~5Uzi4RvtTwlEXp'
            }
url = "https://10.11.11.66:1003/config/v6/servers"
try:
    response = requests.get(url=url, headers=headersa, verify=False, timeout=50)
    print(response.text)
except requests.exceptions.RequestException as e:
    print("An error occurred:", e)

When I use Python 3.9, I am able to send an HTTP GET request without any issues, and it functions correctly. However, when I attempt to send the same HTTP GET request within the context of a Django 4.2 project using Python 3.10, I encounter errors or unexpected behavior.

Bala Sundaram
  • 79
  • 1
  • 3
  • https://stackoverflow.com/questions/8814802/python-errno-10054-an-existing-connection-was-forcibly-closed-by-the-remote-h – Jisson Jun 01 '23 at 12:01
  • Thanks, @Jisson for your response, I have tried all those. In python 3.9 it is working properly. Python 3.10 environment only fac facing this issue. File "D:\venv_fr_pych\lib\site-packages\requests\adapters.py", line 501, in send raise ConnectionError(err, request=request) requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None)) – Bala Sundaram Jun 02 '23 at 05:15
  • check the other possibility of verify=False – Jisson Jun 02 '23 at 05:56
  • try with httpx, https://pypi.org/project/httpx/ – Jisson Jun 02 '23 at 06:00
  • https://www.python-httpx.org/ – Jisson Jun 02 '23 at 06:01

0 Answers0