Most viewed recipes tagged "sessions"http://code.activestate.com/recipes/tags/sessions/views/2014-07-03T16:32:53-07:00ActiveState Code RecipesGAE User Session with HTTP Basic Authentication (Python)
2010-05-20T23:49:49-07:00Berendhttp://code.activestate.com/recipes/users/4173891/http://code.activestate.com/recipes/577235-gae-user-session-with-http-basic-authentication/
<p style="color: grey">
Python
recipe 577235
by <a href="/recipes/users/4173891/">Berend</a>
(<a href="/recipes/tags/appengine/">appengine</a>, <a href="/recipes/tags/appspot/">appspot</a>, <a href="/recipes/tags/authentication/">authentication</a>, <a href="/recipes/tags/clients/">clients</a>, <a href="/recipes/tags/gae/">gae</a>, <a href="/recipes/tags/google/">google</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/sessions/">sessions</a>, <a href="/recipes/tags/web/">web</a>, <a href="/recipes/tags/wsgi/">wsgi</a>).
Revision 6.
</p>
<p>HTTP Basic is an unsecure but easy to implement authentication protocol. I think its good enough for a simple client in front of an SSL capable server. Google App-Engine supports SSL, and here is a recipe to set up the user-session using HTTP Basic. </p>
<p>gauth has the code from my not-really-a-recipe listing at:
<a href="http://code.activestate.com/recipes/577217-routines-for-programmatically-authenticating-with-" rel="nofollow">http://code.activestate.com/recipes/577217-routines-for-programmatically-authenticating-with-</a></p>
Python Sessions (Python)
2011-01-08T03:23:05-08:00Sunjay Varmahttp://code.activestate.com/recipes/users/4174115/http://code.activestate.com/recipes/577524-python-sessions/
<p style="color: grey">
Python
recipe 577524
by <a href="/recipes/users/4174115/">Sunjay Varma</a>
(<a href="/recipes/tags/cgi/">cgi</a>, <a href="/recipes/tags/cookie/">cookie</a>, <a href="/recipes/tags/management/">management</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/security/">security</a>, <a href="/recipes/tags/sessions/">sessions</a>).
Revision 2.
</p>
<p>I think this script should now be functional enough to post here at ActiveState. When you reply or vote down, please post some information on your problem with the code, and if you can, maybe something about the solution. This interface works, and is designed especially for Python. If you like it, don't be afraid to post that either, constructive criticism is all good, but compliments are even better! ;)</p>
<p>Get the latest version of this code here:
<a href="http://wiki.sunjay.ca/Python:Contents/Python_Session" rel="nofollow">http://wiki.sunjay.ca/Python:Contents/Python_Session</a></p>
<p><strong>Latest Changes:</strong></p>
<ul>
<li>Added a new function for making the session cookie last longer. See code for <code>set_expires</code>. Note: This new function is just in case you need to include a session for longer than one brower session (for example, one day instead). </li>
</ul>
Routines for programmatically authenticating with the Google Accounts system at Google App-Engine. (Python)
2010-05-20T20:39:50-07:00Berendhttp://code.activestate.com/recipes/users/4173891/http://code.activestate.com/recipes/577217-routines-for-programmatically-authenticating-with-/
<p style="color: grey">
Python
recipe 577217
by <a href="/recipes/users/4173891/">Berend</a>
(<a href="/recipes/tags/auth/">auth</a>, <a href="/recipes/tags/authentication/">authentication</a>, <a href="/recipes/tags/gae/">gae</a>, <a href="/recipes/tags/google/">google</a>, <a href="/recipes/tags/http/">http</a>, <a href="/recipes/tags/sessions/">sessions</a>).
Revision 2.
</p>
<p>This takes two calls, one to the ClientLogin service of Google Accounts,
and then a second to the login frontend of App Engine.</p>
<p>User credentials are provided to the first, which responds with a token.
Passing that token to the _ah/login GAE endpoint then gives the cookie that can
be used to make further authenticated requests.</p>
create a unique session key (Python)
2014-07-03T16:32:53-07:00john stinsonhttp://code.activestate.com/recipes/users/4190325/http://code.activestate.com/recipes/578903-create-a-unique-session-key/
<p style="color: grey">
Python
recipe 578903
by <a href="/recipes/users/4190325/">john stinson</a>
(<a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/sessions/">sessions</a>).
</p>
<p>A simple function that will generate a secure and unique session key.</p>