Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #271 from chrox/fix_269

fix #269 by adding hpts and hptsh in login data
  • Loading branch information...
commit 7ea2255bb6e7b58dbfa77f3bfb3ed52f63b2e3e2 2 parents f257fa4 + 7c07718
Vitaliy Rodnenko authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 geeknote/oauth.py
7 geeknote/oauth.py
View
@@ -4,6 +4,7 @@
import time
import Cookie
import uuid
+import re
from urllib import urlencode, unquote
from urlparse import urlparse
@@ -188,6 +189,10 @@ def login(self):
"GET",
{'oauth_token': self.tmpOAuthToken})
+ # parse hpts and hptsh from page content
+ hpts = re.search('.*"hpts":"(.*?)"', response.data)
+ hptsh = re.search('.*"hptsh":"(.*?)"', response.data)
+
if response.status != 200:
logging.error("Unexpected response status "
"on login 200 != %s", response.status)
@@ -203,6 +208,8 @@ def login(self):
self.postData['login']['username'] = self.username
self.postData['login']['password'] = self.password
self.postData['login']['targetUrl'] = self.url['oauth'] % self.tmpOAuthToken
+ self.postData['login']['hpts'] = hpts and hpts.group(1) or ""
+ self.postData['login']['hptsh'] = hptsh and hptsh.group(1) or ""
response = self.loadPage(self.url['base'],
self.url['login'] + ";jsessionid=" + self.cookies['JSESSIONID'],
"POST",
Please sign in to comment.
Something went wrong with that request. Please try again.