Good question. Retrieving a session by session ID (SID) requires that the session be stored on the server (either in memcache or the datastore). By default, gae-sessions only stores the session in a secure client-side cookie. This is much faster than storing it to the datastore or even memcache (see the performance comparison section at the bottom of this article).
If you want to retrieve a session by SID, then you have to force the session to be stored on the server. You can do this by either turning off cookie-only sessions (only recommended if you need to retrieve by SID often) or by forcing a particular session to be stored server-side (by passing persist_even_if_using_cookie=True
to save()
). More details here.