summaryrefslogtreecommitdiff
path: root/pylibchorus/__init__.py
diff options
context:
space:
mode:
authorkballou <kballou@devnulllabs.io>2015-04-24 19:05:11 -0600
committerkballou <kballou@devnulllabs.io>2015-04-24 19:05:11 -0600
commit0474c99b8a5c12666eb28191af103aa98cfd9934 (patch)
tree71c7b7a7e7e1d7787ff5ac69d01bf00e5dc0993d /pylibchorus/__init__.py
parent96968f9f2d38d45d3154fa3c95860091cc909dd9 (diff)
downloadpylibchorus-0474c99b8a5c12666eb28191af103aa98cfd9934.tar.gz
pylibchorus-0474c99b8a5c12666eb28191af103aa98cfd9934.tar.xz
Return only the necessary attributes
Change the internal `_perform_http_method_` return the status code, JSON object, and cookies dictionary. API functions should extract and return only the necessary attributes.
Diffstat (limited to 'pylibchorus/__init__.py')
-rw-r--r--pylibchorus/__init__.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pylibchorus/__init__.py b/pylibchorus/__init__.py
index f9f912d..079ae14 100644
--- a/pylibchorus/__init__.py
+++ b/pylibchorus/__init__.py
@@ -24,14 +24,16 @@ class ChorusSession(object):
'''create session and return sid and cookies'''
LOG.debug("Opening Chorus Session")
- post = login(
+ code, json, cookies = login(
self.config.get('alpine', 'username'),
self.config.get('alpine', 'password'),
self)
- json = post.json()
+
+ if code != 201:
+ raise RuntimeError("Chorus Session Login Failed")
self.sid = json['response']['session_id']
- self.cookies = dict(post.cookies)
+ self.cookies = dict(cookies)
return self
def __exit__(self, _type, _value, _traceback):