Commit 7c96c2b8 authored by Mindiell's avatar Mindiell

Ok, testing return code for API is fixed

parent b40fcf42
......@@ -337,6 +337,7 @@ class Rp():
self.count_articles()
# Do the same for new RP
Log.debug("Adding article to new RP")
headers = {"Authorization": config.token}
data = {
"url": url,
......@@ -344,14 +345,16 @@ class Rp():
"archive": True if "a" in command else False,
"quote": True if command.count("p") > 1 else False,
}
Log.debug(data)
result = requests.post(
"%s/articles/" % config.api,
data=data,
headers=headers
)
if result.code==200:
if result.status_code>=200 and result.status_code<300:
article = json.loads(result.text)
note = article["score"]
answer = True
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