當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。