Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
itminedu
synnefo
Commits
5616f53e
Commit
5616f53e
authored
Mar 01, 2013
by
Ilias Tsitsimpis
Committed by
Christos Stavrakakis
Mar 12, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement getTokenFromCookie function
parent
bc495361
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
snf-astakos-client/astakosclient/__init__.py
snf-astakos-client/astakosclient/__init__.py
+17
-0
No files found.
snf-astakos-client/astakosclient/__init__.py
View file @
5616f53e
...
...
@@ -34,6 +34,7 @@
import
logging
import
urlparse
import
httplib
import
urllib
import
simplejson
import
objpool.http
...
...
@@ -52,6 +53,22 @@ class AstakosClientException(Exception):
# --------------------------------------------------------------------
# Astakos Client Class
def
getTokenFromCookie
(
request
,
cookie_name
):
"""Extract token from the cookie name provided
Cookie should be in the same form as astakos
service sets its cookie contents:
<user_uniq>|<user_token>
"""
try
:
cookie_content
=
urllib
.
unquote
(
request
.
COOKIE
.
get
(
cookie_name
,
None
))
return
cookie_content
.
split
(
"|"
)[
1
]
except
:
return
None
class
AstakosClient
():
"""AstakosClient Class Implementation"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment