1

I have this host: http://retsau.torontomls.net:7890/and I want to access http://retsau.torontomls.net:7890/rets-treb3pv/server/login, how can I accomplish this using Python Requests? All my attempts till now have failed.

I also followed the solution here - Python Requests - Use navigate site by servers IP and came up with this -

response = requests.get(http://206.152.41.279/rets-treb3pv/server/login, headers={'Host': retsau.torontomls.net})

but that resulted in this error: requests.exceptions.ConnectionError: HTTPConnectionPool(host='206.152.41.279', port=80): Max retries exceeded with url: /rets-treb3pv/server/login (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10a4f6d84>: Failed to establish a new connection: [Errno 60] Operation timed out',))

Funny thing is everything seems to work perfectly fine on Postman, I am able to access all sorts of URLs on that server, from logging in to searching for something.

hky404
  • 1,039
  • 3
  • 17
  • 35

1 Answers1

0

You left out the port number (7890) from the URL to your get call:

response = requests.get('http://206.152.41.279:7890/rets-treb3pv/server/login', headers={'Host': 'retsau.torontomls.net'})
                                             # ^^^^ Add this

Also, unless you actually have a specific reason for accessing the site by IP address, it would make more sense to put the FQDN in the URL rather than the Host header:

response = requests.get('http://retsau.torontomls.net:7890/rets-treb3pv/server/login')
jwodder
  • 54,758
  • 12
  • 108
  • 124