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


Python Session.Session类代码示例

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


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

示例1: openSession

 def openSession(self):
     session = Session()
     session.exec()
     if session.ret:
         if session.new:
             self.onBtnLoadRef()
         else:
             print(session.sel)
开发者ID:HenricusRex,项目名称:TMV3,代码行数:8,代码来源:Viewer.py

示例2: testInsert

 def testInsert(self):
     sdao = SessionDAO()
     session = Session()
     session.startDate = '2009-10-10' 
     session.lastUpdate = '2009-10-10' 
     session.source.id = self.sourceId
     session.file.id = self.fileId
     session.address.id = self.addressId
     sid = sdao.insert(session)
     assert sid != -1, 'error inserting session'
开发者ID:tassia,项目名称:DonkeySurvey,代码行数:10,代码来源:SessionTestCase.py

示例3: do_HEAD

	def do_HEAD(self, method = 'get', postData = {}):
		self.session = Session.load(Session.determineKey(self))
		self.processingRequest()

		try:
			self.buildResponse(method, postData)
			self.sendHead()
		except Redirect as r:
			self.responseCode = 302
			self.response = ''
			self.sendHead(additionalHeaders = {'Location': r.target})
开发者ID:mrozekma,项目名称:Rorn,代码行数:11,代码来源:HTTPHandler.py

示例4: getHeatMapSessions

	def getHeatMapSessions(self,_json=True):
		_h = []
		_e = []
		_t = []
		_nSessions = 0 
		_x = 0
		for _folder in reversed(os.listdir(self._dataFolder)):
			for _device in self.devices:
				if _device in _folder: #get only the folders from his/her device
					_file = self._dataFolder + _folder 
					_d = Session(_file)
					_mdata = _d.getMetaDataOnly()
					_avgHR = _mdata["session"]["statistics"]["HR_avg"]
					_avgEDA = _mdata["session"]["statistics"]["EDA_avg"]
					_avgTEMP = _mdata["session"]["statistics"]["TEMP_avg"]
					_HM_HR= {}
					_HM_EDA= {}
					_HM_TEMP= {}
					if(_avgHR > 90):
						_HM_HR["sessionId"] = _folder 
						_HM_HR["date"] = int(_folder[:-7])
						_HM_HR["value"] = 60 + _x #silly hack to get links on the heatmap
					else:
						_HM_HR["sessionId"] = _folder 
						_HM_HR["date"] = int(_folder[:-7])
						_HM_HR["value"] = 2 + _x 
					print _HM_HR
					_h.append(_HM_HR)
					if(_avgEDA > 5):
						_HM_EDA["sessionId"] = _folder 
						_HM_EDA["date"] = int(_folder[:-7])
						_HM_EDA["value"] = 60 + _x 
					else:
						_HM_EDA["sessionId"] = _folder 
						_HM_EDA["date"] = int(_folder[:-7])
						_HM_EDA["value"] = 2+ _x 
					_e.append(_HM_EDA)
					if(_avgTEMP > 37.5):
						_HM_TEMP["sessionId"] = _folder 
						_HM_TEMP["date"] = int(_folder[:-7])
						_HM_TEMP["value"] = 60+ _x 
					else:
						_HM_TEMP["sessionId"] = _folder 
						_HM_TEMP["date"] = int(_folder[:-7])
						_HM_TEMP["value"] = 2+ _x 
					_t.append(_HM_TEMP)
					_x +=1

		if(_json):
			return [json.dumps(_h),json.dumps(_e),json.dumps(_t)]
		else:
			return [_HM_HR,_HM_EDA,_HM_TEMP]
开发者ID:panzerfausten,项目名称:empatica_assigment_app,代码行数:52,代码来源:Data.py

示例5: doTests

	def doTests(self,_json=True):
		#create a new session and call check to the last 5 sessions
		_results = []
		_resultJson = {"device_id":self.device,"tests":[]}
		for _x,_s in  enumerate(self._sessions):
			_se = Session(_s)
			_res = _se.checkSessionStatus()
			_results.append(_res)
			_resultJson["tests"].append(_res)
			if _x == 4:
				break
		if(_json):
			return json.dumps(_resultJson)
		else:
			return _results
开发者ID:panzerfausten,项目名称:empatica_assigment_app,代码行数:15,代码来源:DeviceStatus.py

示例6: __init__

 def __init__(self, parent=None, callback=None):
     """
     @summary: Create new authentication dialog.
     @param parent: GtkWindow parent.
     """
     super(AuthDialog, self).__init__()
     
     self.__session__ = Session()
     
     super(AuthDialog, self).set_title(self.__trans__("Google Authentication"))
     super(AuthDialog, self).set_flags(gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
     super(AuthDialog, self).add_buttons(gtk.STOCK_OK, gtk.RESPONSE_OK)
     
     super(AuthDialog, self).set_transient_for(parent)
     if (parent != None):
         super(AuthDialog, self).set_position(gtk.WIN_POS_CENTER_ON_PARENT)
     else:
         super(AuthDialog, self).set_position(gtk.WIN_POS_CENTER)
     
     # Add signals
     super(AuthDialog, self).connect("response", self.__closeEvent__)
     super(AuthDialog, self).set_size_request(self.__DEFAULT_WINDOW_WIDTH__, self.__DEFAULT_WINDOW_HEIGHT__)
     
     self.__initUI__()
     self.__callback__ = callback
开发者ID:babytux,项目名称:PyCamimg,代码行数:25,代码来源:AuthDialog.py

示例7: getSessions

	def getSessions(self,_json=True):
		_availableSessions = {"sessions":[],"count":0}
		_nSessions = 0 
		for _folder in reversed(os.listdir(self._dataFolder)):
			for _device in self.devices:
				if _device in _folder: #get only the folders from his/her device
					_file = self._dataFolder + _folder 
					_d = Session(_file)
					_availableSessions["sessions"].append(_d.getMetaDataOnly())
					_nSessions += 1
		_availableSessions["count"] = _nSessions

		if(_json):
			return json.dumps(_availableSessions)
		else:
			return _availableSessions
开发者ID:panzerfausten,项目名称:empatica_assigment_app,代码行数:16,代码来源:Data.py

示例8: login

    def login(cls, para):
        if not checkPara(para, ['version', 'did', ('type', lambda x: x in [cls.DEVICE_TYPE, cls.FB_TYPE])]):
            return Error.INVALID_PARAM

        version = para['version']
        did = para['did']

        if para['type'] == cls.DEVICE_TYPE:
            (uid, is_new) = Login.device_login(did)
        else:
            if para['fb_id'] in para['frd_list']:
                return Error.INVALID_PARAM

            (uid, is_new) = Login.fb_login(did, para['fb_id'], para['fb_name'], para['frd_list'])

        sid = Session.gen_session(uid)
        ret = {'uid': uid, 'sid': sid}

        user_info = User(uid).get(['coin', 'level', 'exp', 'name'], True)
        user_info['exp'] /= 100

        ret.update(user_info)

        if version < Config.LATEST_VERSION:
            ret['update'] = Config.PKG_URL

        User(uid).login_time = int(time.time())

        if 'ip' in para:
            g = cls.GEO.city(para['ip'])
            Location.update(uid, g['country_code'], g['region'])

        return ret
开发者ID:,项目名称:,代码行数:33,代码来源:

示例9: __init__

 def __init__(self,name,attrs={},logger=None,logpath='./'):
     self.sutname=name
     self.attrs=attrs        
     command = attrs.get('CMD')
     if not attrs.get('TIMEOUT'):
         self.attrs.update({'TIMEOUT':int(30)})
     else:
         self.attrs.update({'TIMEOUT':int(attrs.get('TIMEOUT'))})
     #spawn.__init__(self, command, args, timeout, maxread, searchwindowsize, logfile, cwd, env, ignore_sighup)
     import os
     log = os.path.abspath(logpath)
     log= '%s%s%s'%(log,os.path.sep,'%s.log'%name)
     if self.attrs.get('LOGIN'):
         from common import csvstring2array
         self.loginstep= csvstring2array(self.attrs['LOGIN'])
      
     self.seslog = open(log, "wb")
     CSession.__init__(self, name, attrs,logger, logpath)
开发者ID:try-dash-now,项目名称:dash-ia,代码行数:18,代码来源:Cisco.py

示例10: button_click

 def button_click(self):
     global configWin
     global session
     global myapp
     global mail
     pop3Name=str(configWin.ui.lineEdit.text())
     smtpName=str(configWin.ui.lineEdit_2.text())
     userName=str(self.ui.lineEdit.text())
     passwd=str(self.ui.lineEdit_2.text())
     session=Session([pop3Name, smtpName, userName, passwd])
     resultcode=session.sessionLogin()
     if resultcode==0:
         lastaccount=[pop3Name, smtpName, userName, passwd]
         init.writein(lastaccount)
         mail=MyMail(session)
         myapp = MyMailBox()
         myapp.show()
         myapp.ui.menubar.addMenu(lastaccount[2]).addAction(myapp.ui.logout)
         self.close()
开发者ID:brightmood,项目名称:pymail,代码行数:19,代码来源:test.py

示例11: initSession

	def initSession(self, phone, AESKey):
		print "Core.initSession called"
		if self.session == None or self.session.authStatus == Constants.AUTHSTATUS_IDLE:	#self.yowsupStarted==0 and 
			self.yowsupStarted = 1
			if self.session == None:
				self.session = Session(self, phone, AESKey)
				self.session.getAuthData()
				self.signalsInterface.registerListener("disconnected", self.onDisconnected) 
			self.session.login()
		else:
			print "\nPretty sure yowsup is already started."
开发者ID:akshayah3,项目名称:webwhatsapp,代码行数:11,代码来源:Core.py

示例12: lock

    def lock(self, type=Constants.LockType_Shared):
        """Contextmanager yielding a session to a locked machine.

        Machine must be registered."""
        session = Session.create()
        with VirtualBoxException.ExceptionHandler():
            self.getIMachine().lockMachine(session.getISession(), type)
        try:
            session._setMachine(VirtualMachine(session.getIMachine()))
            yield session
        finally:
            session.unlockMachine(wait=True)
开发者ID:aburan28,项目名称:pyVBox,代码行数:12,代码来源:VirtualMachine.py

示例13: folderAdd

        def folderAdd(self, folderObject):
                """
                        each time one adds a new FileWalker object it triggers 
                        a new session that is stored using the unique FileWalker 
                        name
                """
                if isinstance(folderObject, FileWalker):
                        
                        # clone list of classes and create new
                        thisSession = Session(folderObject.name, folderObject.path, self.classes)

                        # iterate over all files
                        thisSession.addFiles(folderObject)
                        
                        # append the completed session to the list
                        self.sessions.append(thisSession)

                        print "add Folder: %s" % folderObject.name

                else:
                        return NotImplemented
                return True
开发者ID:pombreda,项目名称:PyFileClassParser,代码行数:22,代码来源:PyFileClassParser.py

示例14: __init__

 def __init__(self, credentials):
     self.credentials = credentials
     self.queue = RequestQueue(request_limit=600)
     self.session = Session(self.credentials, self.queue)
     self.all_endpoints = {'ticket':{'plural':'tickets', 'singular':'ticket'}, 
                         'organization':{'plural':'organizations', 'singular':'organization'},
                         'requester': {'plural':'users','singular':'user'},
                         'user': {'plural':'users','singular':'user'},
                         'assignee': {'plural':'users','singular':'user'}}
     self.object_cache = BasicCache()
     self.tickets = Endpoint('ticket', self)
     self.organizations = Endpoint('organization', self)
     self.users = Endpoint('user', self)
开发者ID:Nebopolis,项目名称:pyzendesk,代码行数:13,代码来源:Wrapper.py

示例15: validate

  def validate(self, name, pwd):
    cur = self._conn.cursor()

    cur.execute("""
      SELECT users.id   as id
            ,users.name as name
            ,auth.hash  as pass
        FROM users
            ,auth
       WHERE users.id   = auth.user_id
         and users.name = '""" + name + """'
         and auth.hash  = '""" + pwd + """'
    """)

    numrows = cur.rowcount
    assert numrows in {0, 1}

    if numrows == 0:
      return None

    row = cur.fetchone()
    sess = Session()
    sess.set(row[0], row[1], 9999)
    return sess
开发者ID:cwbriscoe,项目名称:pyweb,代码行数:24,代码来源:Auth.py


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