Skip to content

Commit 4a33375

Browse files
authored
[XK] fix error on setting authorization cookie (#14)
fix `AttributeError: 'LWPCookieJar' object has no attribute 'update'` this error only occurs for log-ins with CAPTCHA prompted.
1 parent b1cf205 commit 4a33375

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libxduauth/sites/xk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ def __init__(self, username, password, keyword=''):
4343
self.user['electiveBatchList']
4444
))
4545
self.persist('batch', json.dumps(self.current_batch))
46-
cookies = requests.utils.dict_from_cookiejar(self.cookies)
47-
self.cookies.update({'Authorization': cookies['token']})
46+
cookie_token = next(c for c in self.cookies if c.name == "token")
47+
self.persist("Authorization", cookie_token.value)
4848
self.get(self.BASE + '/elective/grablessons', params={
4949
'batchId': self.current_batch['code'],
5050
}) # wierd, yet mandatory.
51-
self.headers.update({'Authorization': cookies['token']})
51+
self.headers.update({'Authorization': cookie_token.value})
5252

5353
def persist(self, name, value):
5454
self.cookies.set_cookie(requests.cookies.create_cookie(

0 commit comments

Comments
 (0)