Commit 471c635c authored by Alessandro Melchiorre's avatar Alessandro Melchiorre
Browse files

# Solved case when the call returned successfully but with the wrong answer

parent 10542c14
......@@ -30,6 +30,7 @@ class LastFMCrawler:
if time_passed <= 0.3:
time.sleep(time_passed)
content = None
while True:
try:
rs = requests.get(url)
......@@ -39,6 +40,9 @@ class LastFMCrawler:
if status != "200 OK":
raise Exception(status)
content = json.loads(rs["body"])
# Crash test
_ = content['recenttracks']
break
except Exception as e:
......@@ -49,7 +53,7 @@ class LastFMCrawler:
time.sleep(0.8)
n_trials += 1
return json.loads(rs["body"])
return content
def _slimmer(self, json):
# Get rids of the useless images
......
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