views:

25

answers:

0

I'm downloading a web page (with PyQt4/QtWebKit) using given hostname, but I would like to use a pre-defined IP address for that hostname. For example, I need to hit "http://www.mysite.com" but use the IP address 1.2.3.4 instead of the actual resolved IP address. Is this at all possible in QtWebKit? I've tried a couple things so far:

  1. Hitting http://1.2.3.4/ and sending a "Host" header of "www.mysite.com". This almost works, but ends up failing for a number of reasons (I'd be happy to go into more detail here).

  2. Using a global /etc/hosts setting. This didn't work because it is hard to automate and I will be doing multiple downloads at once.

Is there a way to either in python or in PyQt4/QtWebKit to override the IP address associated with a hostname?

This is big for me. Any help at all would be greatly appreciated.