0

Is there a way to force Python's client.HTTPConnection to connect to a specific IP address? I am writing a program that checks for the presence of a file on a web server, but I want to check every single web server, and the web servers use DNS round-robin. So I am using dns.resolver.query to get a list of all of the IP addresses associated with a specific IP address, and then I am using client.HTTPConnection to connect to each one. At least, that's what I want to do, but the client.HTTPConnection doesn't seem to.

Internally, client.HTTPConnection eventually calls socket.create_connection, but I've traced the code and can't figure out a good work-around.

I've tried URL's like http://2899902734:80/ for Google as well as http://172.217.1.14 and they don't work.

vy32
  • 28,461
  • 37
  • 122
  • 246
  • two questions: 1. Are you just checking for the existance of a file? and 2. you know that a file exists on `172.217.1.14`? Thx – arcee123 Apr 28 '16 at 16:38
  • I'm collecting the HTTP headers, but not the body. I'm sending a HEAD command. – vy32 Apr 28 '16 at 18:19
  • maybe you could do it more of a rest pattern using urlib: http://stackoverflow.com/questions/7347888/how-do-i-check-if-a-file-on-http-exists-using-python-django – arcee123 Apr 29 '16 at 21:19

0 Answers0