Python session.Session() Examples
The following are 9
code examples of session.Session().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
session
, or try the search function
.
Example #1
Source File: sessionmanager.py From EvilTwinFramework with GNU General Public License v2.0 | 6 votes |
def start_new_session(self, name): if self._session: self.close_session() self._is_temporary = True self._session_name = name self._date = strftime("%d_%m_%Y") if self._date not in os.listdir(self._sessions_folder): self._session_id = 1 self._session = Session(self._date, self._session_id, self._session_name) self._session_folder = self._sessions_folder + self._session.path os.mkdir(self._sessions_folder + self._date) os.mkdir(self._session_folder) else: self._session_id = len(os.listdir(self._sessions_folder + self._date)) + 1 self._session = Session(self._date, self._session_id, self._session_name) self._session_folder = self._sessions_folder + self._session.path os.mkdir(self._session_folder) self._initiate_reporters()
Example #2
Source File: connection.py From qpid-python with Apache License 2.0 | 6 votes |
def attach(self, name, ch, delegate, force=False): self.lock.acquire() try: ssn = self.attached.get(ch.id) if ssn is not None: if ssn.name != name: raise ChannelBusy(ch, ssn) else: ssn = self.sessions.get(name) if ssn is None: ssn = Session(name, delegate=delegate) self.sessions[name] = ssn elif ssn.channel is not None: if force: del self.attached[ssn.channel.id] ssn.channel = None else: raise SessionBusy(ssn) self.attached[ch.id] = ssn ssn.channel = ch ch.session = ssn return ssn finally: self.lock.release()
Example #3
Source File: session_manager.py From backend with GNU General Public License v2.0 | 5 votes |
def open_session(self, session_id, msg): if session_id in self.sessions: return 'CLS,' + session_id remote_ip = None client_version = None if msg: remote_ip = msg.get('RemoteIp', None) client_version = msg.get('ClientVersion', None) self.sessions[session_id] = [0, datetime.datetime.now(), Session( session_id, remote_ip, client_version ) ] return 'OPN,' + session_id
Example #4
Source File: ibombshell.py From ibombshell with GNU General Public License v3.0 | 5 votes |
def load(self, user_input=None): if not user_input: self._raise_exception_specify("module") self.session = Session(user_input[0]) # The module is incorrect if not(self.session.correct_module()): print_error('Invalid module') self.session = None else: self.comp.set_commands_to_set(self.session.get_options_name())
Example #5
Source File: Server.py From CineMonster with Apache License 2.0 | 5 votes |
def command_start(self, bot, update): chat_id = update.message.chat_id if chat_id not in self.SESSIONS.keys(): self.messenger = interfaces.TelegramMessenger(bot, self.logger) self.SESSIONS[chat_id] = session.Session( chat_id, self.config_instance, self.logger) self.SESSIONS[chat_id].set_messenger(self.messenger) self.SESSIONS[chat_id].quiz = quiz.Quiz(self.SESSIONS[chat_id])
Example #6
Source File: sessionmanager.py From EvilTwinFramework with GNU General Public License v2.0 | 5 votes |
def _load_previous_session(self, date, id): self._session_name = self._get_session_name(date, id) print "[+] Loading session '{}'!".format(self._session_name) self._session = Session(date, id, self._session_name) self._load_info_from_current_session()
Example #7
Source File: sessionmanager.py From EvilTwinFramework with GNU General Public License v2.0 | 5 votes |
def load_session(self, index): if index >= len(self._session_list): print "[-] Session index out of bounds!" return if self._is_temporary: self._cleanup_tmp_session() self._session = self._session_list[index] self._load_info_from_current_session()
Example #8
Source File: sessionmanager.py From EvilTwinFramework with GNU General Public License v2.0 | 5 votes |
def _load_all_sessions(self): self._session_list = [ Session(datefolder, int(session.split("_")[0][-1]), "_".join(session.split("_")[1:])) for datefolder in os.listdir(self._sessions_folder) if os.path.isdir(self._sessions_folder + "/" + datefolder) for session in os.listdir(self._sessions_folder + "/" + datefolder) ]
Example #9
Source File: session_mgr.py From voltha with Apache License 2.0 | 5 votes |
def create_session(self, user): session = Session(self.next_session_id, user) self.sessions[self.next_session_id] = session self.next_session_id += 1 return session