19.1.37. camcops_server.cc_modules.cc_session¶
Copyright (C) 2012-2018 Rudolf Cardinal (rudolf@pobox.com).
This file is part of CamCOPS.
CamCOPS is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
CamCOPS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with CamCOPS. If not, see <http://www.gnu.org/licenses/>.
-
class
camcops_server.cc_modules.cc_session.
CamcopsSession
(ip_addr=None, last_activity_utc=None)[source]¶ Class representing an HTTPS session.
-
classmethod
get_session
(req: CamcopsRequest, session_id_str: Union[str, NoneType], session_token: Union[str, NoneType]) → CamcopsSession[source]¶ Retrieves, or makes, a new CamcopsSession for this Pyramid Request, for a specific session_id and session_token.
Makes, or retrieves, a new CamcopsSession for this Pyramid Request.
-
classmethod
-
camcops_server.cc_modules.cc_session.
generate_token
(num_bytes: int = 16) → str[source]¶ Make a new session token that’s not in use. It doesn’t matter if it’s already in use by a session with a different ID, because the ID/token pair is unique. (Removing that constraint gets rid of an in-principle-but-rare locking problem.)