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

Commit daba688f authored by Daniel Watkins's avatar Daniel Watkins

Deal with incorrect username.

parent b582121a
......@@ -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
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:
......
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