当前位置: 首页>>代码示例>>Python>>正文


Python session.Session方法代码示例

本文整理汇总了Python中session.Session方法的典型用法代码示例。如果您正苦于以下问题:Python session.Session方法的具体用法?Python session.Session怎么用?Python session.Session使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在session的用法示例。


在下文中一共展示了session.Session方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start_new_session

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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() 
开发者ID:Esser420,项目名称:EvilTwinFramework,代码行数:22,代码来源:sessionmanager.py

示例2: attach

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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() 
开发者ID:apache,项目名称:qpid-python,代码行数:26,代码来源:connection.py

示例3: open_session

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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 
开发者ID:bitex-coin,项目名称:backend,代码行数:14,代码来源:session_manager.py

示例4: load

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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()) 
开发者ID:ElevenPaths,项目名称:ibombshell,代码行数:12,代码来源:ibombshell.py

示例5: command_start

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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]) 
开发者ID:toymak3r,项目名称:CineMonster,代码行数:10,代码来源:Server.py

示例6: _load_previous_session

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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() 
开发者ID:Esser420,项目名称:EvilTwinFramework,代码行数:7,代码来源:sessionmanager.py

示例7: load_session

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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() 
开发者ID:Esser420,项目名称:EvilTwinFramework,代码行数:11,代码来源:sessionmanager.py

示例8: _load_all_sessions

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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)
                                 ] 
开发者ID:Esser420,项目名称:EvilTwinFramework,代码行数:8,代码来源:sessionmanager.py

示例9: create_session

# 需要导入模块: import session [as 别名]
# 或者: from session import Session [as 别名]
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 
开发者ID:opencord,项目名称:voltha,代码行数:7,代码来源:session_mgr.py


注:本文中的session.Session方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。