We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit a384e31b authored by Daniel Watkins's avatar Daniel Watkins

Deal with incorrect username.

parent 7ef84190
......@@ -38,6 +38,10 @@ def parse_track(row):
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
f = urllib2.urlopen(url)
except urllib2.HTTPError:
raise Exception("Username probably does not exist.")
soup = BeautifulSoup(urllib2.urlopen(url),
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment