an
saurus
tags:
hosts
ip
python
urllib2
windows
views:
110
answers:
1
Q:
urllib2 in Python 2.6.4: Any way to override windows hosts file?
+2
A:
Connect to the IP address and pass the
Host
header manually.
Ignacio Vazquez-Abrams
2010-04-02 20:58:27
But how would you know the IP? (Assuming it's not hardcoded - or is it?) You can't use a regular gethostbyname call, since that again uses the hosts file...
Wim
2010-04-02 21:02:07
You could use a separate DNS client to find it ... of course, that leads directly to the question: what DNS server?
SamB
2010-04-02 21:06:54
What if the domain name needs to go in the request header? See my edit.
mikez302
2010-04-02 21:17:49
Oh, right ... I dunno if urllib2 can handle that or not...
SamB
2010-04-02 21:25:26
For a separate DNS client, see dnspython.
bobince
2010-04-02 23:34:23
related questions
Verifying files for testing
How do you create your own moniker (URL Protocol) on Windows systems?
Windows Equivalent of 'nice'
Is this a good way to determine OS Architecture?
Dual vs. Quadcore on a Webserver
Is there a WMI Redistributable Package?
PHP Error - Uploading a file
Ruby On Rails with Windows Vista - Best Setup?
OpenVPN Config file to prevent timeout
How can I create Debian install packages in Windows for a Visual Studio project?
How do I configure and communicate with a serial port?
What's the best setup for Mono development on Windows?
Appropriate pagefile size for SQL Server
XML Editing/Viewing Software
Linux shell equivalent on IIS
What is a better file copy alternative than the Windows default?
Windows Help files - what are the options?
Heap corruption under Win32; how to locate?
Best way to access Exchange using PHP?
Get a preview jpeg of a pdf on windows?
WinForms ComboBox data binding gotcha
How do you schedule tasks in Windows?
Register Windows program with the mailto protocol programmatically
Embedding Windows Media Player for all Browsers
Best Subversion clients for Windows Vista (64bit)