[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1437] Deal with incorrect username.
From: |
Daniel Watkins |
Subject: |
[Librefm-commits] [1437] Deal with incorrect username. |
Date: |
Sat, 09 May 2009 13:11:58 +0000 |
Revision: 1437
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1437
Author: odd_bloke
Date: 2009-05-09 13:11:57 +0000 (Sat, 09 May 2009)
Log Message:
-----------
Deal with incorrect username.
Modified Paths:
--------------
trunk/lastscrape/lastscrape.py
Modified: trunk/lastscrape/lastscrape.py
===================================================================
--- trunk/lastscrape/lastscrape.py 2009-05-09 13:06:58 UTC (rev 1436)
+++ trunk/lastscrape/lastscrape.py 2009-05-09 13:11:57 UTC (rev 1437)
@@ -38,6 +38,10 @@
def fetch_tracks(user, request_delay=0.5):
"""Fetch all tracks from a profile page and return a list."""
url = 'http://last.fm/user/%s/tracks' % user
+ try:
+ f = urllib2.urlopen(url)
+ except urllib2.HTTPError:
+ raise Exception("Username probably does not exist.")
soup = BeautifulSoup(urllib2.urlopen(url),
convertEntities=BeautifulSoup.HTML_ENTITIES)
try:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1437] Deal with incorrect username.,
Daniel Watkins <=