Commit f7ba3600 authored by Mindiell's avatar Mindiell

Ok, testing return code for API is fixed (3)

parent 5d946fff
......@@ -355,9 +355,12 @@ class Rp():
Log.error("Erreur lors de l'appel à l'API : " + str(e))
Log.debug(result.status_code)
if result.status_code>=200 and result.status_code<300:
article = json.loads(result.text)
note = article["score"]
answer = True
try:
article = json.loads(result.text)
note = article["score"]
answer = True
except Exception as e:
Log.error("Erreur lors de la récupération de l'article : " + str(e))
if answer:
# Answer is now based on where, who, note, and a little magic
return self.did_rp(channel, user, note)
......
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