473,472 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

urlopen

Hi all,
I'm running into some trouble using urllib.urlopen to grab a page from our
corporate intranet. The name of the internal site is simply http://web (no
www or com). I can use urlopen to grab a site like http://www.google.com
just fine. However, when I use urlopen to grab the internal site, I instead
get data from http://www.web.com. This is the url returned by the geturl()
function.
There must be a way to stop Python, or whoever is doing it, from changing
my url. Maybe urllib is not the correct approach. Does anyone know a
solution to this?
Thanks,
Dave
Apr 26 '07 #1
1 1741
On Apr 26, 12:39 pm, "Dave Dean" <dave.d...@xilinx.comwrote:
Hi all,
I'm running into some trouble using urllib.urlopen to grab a page from our
corporate intranet. The name of the internal site is simplyhttp://web(no
www or com). I can use urlopen to grab a site likehttp://www.google.com
just fine. However, when I use urlopen to grab the internal site, I instead
get data fromhttp://www.web.com. This is the url returned by the geturl()
function.
There must be a way to stop Python, or whoever is doing it, from changing
my url. Maybe urllib is not the correct approach. Does anyone know a
solution to this?
Thanks,
Dave
Dunno for sure, but maybe you should be using urllib2. Good info on
the module can be found here: http://www.voidspace.org.uk/python/a...#fetching-urls

I suppose you could also edit your hosts file too.

Mike

Apr 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: MAK | last post by:
I'm stumped. I'm trying to use Python 2.3's urllib2.urlopen() to open an HTML file on the local harddrive of my WinXP box. If I were to use, say, Netscape to open this file, I'd specify it as...
1
by: Egor Bolonev | last post by:
how they define proxy in urlopen? i've tried a=urlopen('url', proxies=('127.0.0.1:3128')) a=urlopen('url', proxies='127.0.0.1:3128') but it says there is an error ...
2
by: John F Dutcher | last post by:
Can anyone comment on why the code shown in the Python error is in some way incorrect...or is there a problem with Python on my hoster's site ?? The highlites don't seem to show here...but line...
11
by: Pater Maximus | last post by:
I am trying to implement the recipe listed at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/211886 However, I can not get to first base. When I try to run import urllib...
0
by: Matt | last post by:
I'm trying to get the HTML data off of a webpage. Let's say for the sake of argument it's the python homepage. I've googled around and found some examples that people said worked. Here's what...
0
by: Ritesh Raj Sarraf | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, In urllib.urlretrieve I can use reporthook to implement a progress bar. But in urllib2.urlopen I can't. I have to use urllib2.urlopen...
3
by: Tempo | last post by:
Hello. I am getting an error and it has gotten me stuck. I think the best thing I can do is post my code and the error message and thank everybody in advanced for any help that you give this issue....
4
by: kgrafals | last post by:
Hi, I'm just trying to read from a webpage with urllib but I'm getting IOErrors. This is my code: import urllib sock = urllib.urlopen("http://www.google.com/") and this is the error:
1
by: ken | last post by:
Hi, When I call urlopen.read() like this: data = urlopen("http://localhost").read(). Does that mean I will read the whole document to data, regardless how many data being sent back? ...
0
by: Jonas Galvez | last post by:
Try: import re import urllib2 url = 'http://www.google.com/search?num=20&hl=en&q=ipod&btnG=Search' user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' headers = {'User-Agent' :...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.