0

Hello I have a script that I run on my organizations internal network, but it was supposed to run on the 1st but it didn't so I did a backup on my local database of the data so that I can run the script to have the correct data. I changed the url so it lines up with my local site but it is not working as I get an error of

HTTPSConnectionPool(host='localhost', port=44345): Max retries exceeded with url: /logon.aspx (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fc26acb86a0>: Failed to establish a new connection: [Errno 111] Connection refused',)

Here is how I set it up my script to access the url

URL = "https://localhost:44345/logon.aspx"
headers = {"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36"}
username="script"
password="password"
s = Session()
s.verify = False

s.headers.update(headers)
r = s.get(URL)

Why is my connection being refused? I can browse to the site through my internet browser so why am I getting a connection refused?

1 Answers1

0

Since your are running on localhost try http protocol instead of https.

jen
  • 199
  • 1
  • 5
  • Still have the same issue –  Aug 04 '20 at 20:28
  • you can access this ```http://localhost:44345/logon.aspx``` from browser? – jen Aug 04 '20 at 20:34
  • Yes. But only when my visual studio program is running, but it is running when I have tried testing it –  Aug 04 '20 at 20:49
  • maybe it's an issue with your proxy. Try to see this if you haven't seen. [https://stackoverflow.com/questions/43254103/python-requests-return-504-in-localhost](https://stackoverflow.com/questions/43254103/python-requests-return-504-in-localhost) – jen Aug 04 '20 at 21:10