Skip to content
This repository was archived by the owner on Apr 25, 2024. It is now read-only.

Commit 7ea2255

Browse files
author
Vitaliy Rodnenko
committed
Merge pull request vitalyrodnenko#271 from chrox/fix_269
fix vitalyrodnenko#269 by adding hpts and hptsh in login data
2 parents f257fa4 + 7c07718 commit 7ea2255

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

geeknote/oauth.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import time
55
import Cookie
66
import uuid
7+
import re
78
from urllib import urlencode, unquote
89
from urlparse import urlparse
910

@@ -188,6 +189,10 @@ def login(self):
188189
"GET",
189190
{'oauth_token': self.tmpOAuthToken})
190191

192+
# parse hpts and hptsh from page content
193+
hpts = re.search('.*"hpts":"(.*?)"', response.data)
194+
hptsh = re.search('.*"hptsh":"(.*?)"', response.data)
195+
191196
if response.status != 200:
192197
logging.error("Unexpected response status "
193198
"on login 200 != %s", response.status)
@@ -203,6 +208,8 @@ def login(self):
203208
self.postData['login']['username'] = self.username
204209
self.postData['login']['password'] = self.password
205210
self.postData['login']['targetUrl'] = self.url['oauth'] % self.tmpOAuthToken
211+
self.postData['login']['hpts'] = hpts and hpts.group(1) or ""
212+
self.postData['login']['hptsh'] = hptsh and hptsh.group(1) or ""
206213
response = self.loadPage(self.url['base'],
207214
self.url['login'] + ";jsessionid=" + self.cookies['JSESSIONID'],
208215
"POST",

0 commit comments

Comments
 (0)