|
@@ -139,10 +139,16 @@ class labkeyInterface:
|
|
|
|
|
|
def getCSRF(self):
|
|
|
url=self.GetLabkeyUrl()+'/login/whoAmI.view'
|
|
|
- response=self.get(url)
|
|
|
+ try:
|
|
|
+ response=self.get(url)
|
|
|
+ encoding=chardet.detect(response.data)['encoding']
|
|
|
+ jsonData=json.loads(response.data.decode(encoding))
|
|
|
+ except AttributeError:
|
|
|
+ print('Failed')
|
|
|
+ return None
|
|
|
+
|
|
|
self.cookie=response.getheader('Set-Cookie')
|
|
|
- encoding=chardet.detect(response.data)['encoding']
|
|
|
- jsonData=json.loads(response.data.decode(encoding))
|
|
|
+ print('CSRF: {}'.format(jsonData['CSRF']))
|
|
|
return jsonData["CSRF"]
|
|
|
|
|
|
def getUserId(self):
|