Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
[no subject]
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Boštjan Mejak  
View profile  
 More options Oct 29 2012, 4:15 pm
From: Boštjan Mejak <mejak.b...@gmail.com>
Date: Mon, 29 Oct 2012 21:14:56 +0100
Local: Mon, Oct 29 2012 4:14 pm
Subject:

Hellow :)

I have a program – written in Python 2.7.3 and wxPython 2.9.4.0 – that uses
Python's urllib2.urlopen() function/method. The purpose of my program is to
count the occurence of a user-given word that exists on a user-given
website. So if I want to know how many times the word "library" occurs on "
wxpython.org", I type in the URL box "http://www.wxpython.org" (without
quotes), and in the word box I type "library" (without quotes).

My problem is that the user needs to be exact at inputting the URL, because
"wxpython.org" is not enough; it has to be inputted exactly as "
http://www.wxpython.org <http://www.python.org>", which is rather annoying
for the user.

Is there a way the URL be inputted only as "wxpython.org" and
urllib2.urlopen's function/method filling in the missing "http://www."
part? Or is there any other way like checking for the "http://www." part
and prepend it if not present? What is the best way to solve my issue and
how exactly should I go and implement the solution?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "[wxPython-users]" by Karsten Hilbert
Karsten Hilbert  
View profile  
 More options Oct 29 2012, 4:29 pm
From: Karsten Hilbert <Karsten.Hilb...@gmx.net>
Date: Mon, 29 Oct 2012 21:29:20 +0100
Local: Mon, Oct 29 2012 4:29 pm
Subject: Re: [wxPython-users]

There is, and that's probably why it is your homework
assignment. You need to read up on string handling.

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boštjan Mejak  
View profile  
 More options Oct 29 2012, 4:52 pm
From: Boštjan Mejak <mejak.b...@gmail.com>
Date: Mon, 29 Oct 2012 21:52:28 +0100
Local: Mon, Oct 29 2012 4:52 pm
Subject: Re: [wxPython-users]

So I can't do anything else than use the ol' string handling technique of
prepending the missing "http://www." if it's missing in the URL?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim Roberts  
View profile  
 More options Oct 30 2012, 12:03 pm
From: Tim Roberts <t...@probo.com>
Date: Tue, 30 Oct 2012 09:03:36 -0700
Local: Tues, Oct 30 2012 12:03 pm
Subject: Re: [wxPython-users]

Bo�tjan Mejak wrote:

> My problem is that the user needs to be exact at inputting the URL,
> because "wxpython.org <http://wxpython.org>" is not enough; it has to
> be inputted exactly as "http://www.wxpython.org
> <http://www.python.org>", which is rather annoying for the user.

The "http://" part is really required.  The latest round of browsers is
making people lazy, because they fill that in if it's not provided.  I
still find myself typing it by hand.  It's not hard to detect this,
however.  Remember that there are a lot of protocols available for
URLs.  There's no reason for urllib to assume that you meant "http".  If
your program knows that http:// is the default, then it's up to you to
provide it.

The "www" part is different.  That's not universal.  You should be able
to fetch http://wxpython.org and have it work just fine.  You might get
a "redirect" response telling you to fetch www.wxpython.org instead, but
that's something you need to be handling.

--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Boštjan Mejak  
View profile  
 More options Nov 4 2012, 10:28 am
From: Boštjan Mejak <mejak.b...@gmail.com>
Date: Sun, 4 Nov 2012 16:28:49 +0100
Local: Sun, Nov 4 2012 10:28 am
Subject: Re: [wxPython-users]

Is there any HTTP URL-validating function/method in Python/wxPython?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
C M  
View profile  
 More options Nov 4 2012, 11:57 am
From: C M <cmpyt...@gmail.com>
Date: Sun, 4 Nov 2012 11:57:23 -0500
Local: Sun, Nov 4 2012 11:57 am
Subject: Re: [wxPython-users]

On Sun, Nov 4, 2012 at 10:28 AM, Boštjan Mejak <mejak.b...@gmail.com> wrote:
> Is there any HTTP URL-validating function/method in Python/wxPython?

Is this helpful?

http://stackoverflow.com/questions/827557/how-do-you-validate-a-url-w...

-Che


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »