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


Python auth.Auth类代码示例

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


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

示例1: __init__

 def __init__(self):
     Auth.__init__(self)
     
     self._auth_provider = 'ptc'
     
     self._session = requests.session()
     self._session.verify = True
开发者ID:DrChai,项目名称:pgh,代码行数:7,代码来源:auth_ptc.py

示例2: verify_token

def verify_token(token):
    if not token:
        token = request.args.get('token')
    verify = Auth().verify_token(token)
    g.user = verify.get('user')
    g.user['password'] = ''
    return True
开发者ID:emin100,项目名称:barmanapi,代码行数:7,代码来源:app.py

示例3: upload_photos

def upload_photos(set, photos, key, secret, checkpoint):
	try:
		auth = Auth(key, secret)
		auth.authenticate()
	except urllib2.HTTPError as e:
		print e.read()
		raise

	set_controller = Photosets(auth)

	# Work queue to print upload status
	ui_wq = WorkQueue(print_status, num_workers = 1)

	upload_and_add(photos[0], set, auth, set_controller, ui_wq, checkpoint)

	wq = WorkQueue(upload_and_add, 
		num_workers = 16, 
		max_queue_size = 50, 
		set = set, 
		auth = auth, 
		set_controller = set_controller,
		ui_wq = ui_wq,
		checkpoint = checkpoint)

	for photo in photos[1:]:
		wq.add(photo)
	
	wq.done()
	ui_wq.done()
开发者ID:rahuliyer,项目名称:flickr_uploader,代码行数:29,代码来源:flickr_uploader.py

示例4: _authenticate

def _authenticate(co, ch, remote, srp, txn):
    stuple = (remote[0], remote[1], '')
    server = tuple_to_server(stuple)

    auth = Auth(co, co.user, server, txn)
    ch.auth = auth

    s = ch.start_connection((remote[0], remote[1]))

    if srp:
        ch.srp_auth(s)
        return s

    hash = ch.get_hash(s)

    if not auth.check_hash(hash):
        # we don't know about the secret, fall back to SRP
        ch.srp_auth(s)
        ch.get_secret(s)

        s = ch.start_connection((remote[0], remote[1]))

    ch.secret_auth(s)
    auth.forget()

    return s
开发者ID:GymWenFLL,项目名称:tpp_libs,代码行数:26,代码来源:client_net.py

示例5: send_url

def send_url(url, reauth):
    """Sends a URL to the phone"""

    params = {'url': url,
              'title': '',
              'sel': '',
              'type': '',
              'deviceType': 'ac2dm'}
    auth = Auth(reauth=reauth)
    auth.request(baseUrl, params)
开发者ID:puggan,项目名称:cli2phone,代码行数:10,代码来源:cli2phone.py

示例6: on_accept

 def on_accept(self):
     auth = Auth()
     if auth.doLogin(str(self.userNameLineEdit.text()), str(self.passwordLineEdit.text())):
         self.setResult(self.Success)
     else:
         msgBox = QMessageBox(self)
         msgBox.setIcon(QMessageBox.Warning)
         msgBox.setWindowTitle(_translate("LoginDialog", "PAT Login message", None))
         msgBox.setText(_translate("LoginDialog", "Either incorrect username and/or password. Try again!", None))
         msgBox.setStandardButtons(QMessageBox.Ok)
         msgBox.exec_()
         self.setResult(self.Failed)
开发者ID:MazeFX,项目名称:pat,代码行数:12,代码来源:dialogs.py

示例7: on_accept

    def on_accept(self):

        auth = Auth()
        if auth.do_login(self.txtUsername.text(), self.txtPassword.text()):
            self.setResult(self.Success)
        else:
            msg_box = QMessageBox(self)
            msg_box.setIcon(QMessageBox.Warning)
            msg_box.setWindowTitle(_translate("LoginDialog", "Pythonthusiast", None))
            msg_box.setText(_translate("LoginDialog", "Either incorrect username and/or password. Try again!", None))
            msg_box.setStandardButtons(QMessageBox.Ok)
            msg_box.exec_()
            self.setResult(self.Failed)
开发者ID:bmweller,项目名称:CrossPlatformQt,代码行数:13,代码来源:logindialog.py

示例8: get_session_key

    def get_session_key(self, connection):
        '''
        Queries the publisher's server and returns a session key for use in
        future queries.
        '''
        # Create an Auth object to create the request to the publisher.
        auth = Auth()
        auth.config = self.config

        schemas = AUTH_SCHEMAS
        url, status, headers, body = auth.request(connection, schemas=schemas)

        return body['sessionKey']
开发者ID:polarmobile,项目名称:polar.paywall.test,代码行数:13,代码来源:validate.py

示例9: ajax

    def ajax(self, url, data={}, referer=False):
        try:
            self.auth = Auth()
            self.cookie = self.auth.get_cookies()
            headers = {
                'X-Requested-With' : 'XMLHttpRequest'
            }
            if(referer):
                headers['Referer'] = referer


            cook = self.mycookie if self.cookie == None else self.cookie
            if(len(data) > 0):
                response = xbmcup.net.http.post(url, data, cookies=cook, headers=headers, verify=False)
            else:
                response = xbmcup.net.http.get(url, cookies=cook, headers=headers, verify=False)

            if(self.cookie == None):
                self.mycookie = response.cookies

        except xbmcup.net.http.exceptions.RequestException:
            print traceback.format_exc()
            return None
        else:
            return response.text if response.status_code == 200 else None
开发者ID:evgen-dev,项目名称:repository.evgen_dev.xbmc-addons,代码行数:25,代码来源:http.py

示例10: load_members

def load_members(congress):
    for chamber in ['house', 'senate']:
        resp = requests.get(Auth.times_api_route(congress, chamber))
        assert resp.status_code == 200, ('bad response getting list for %s: %d' % (chamber, resp.status_code))
        results = json.loads(resp.text)
        for member_json in results["results"][0]["members"]:
            member = create_new_member(congress, chamber, member_json)
开发者ID:bajh,项目名称:congress-tweet-collection,代码行数:7,代码来源:members.py

示例11: test2

 def test2(self):
     # test a faulty login, with unknown user
 
     creds = MemoryCredentialStore()
     chals = MemoryChallengeStore()
     a = Auth(creds, chals)
     
     # client asks for challenge
     c = a.new_challenge()
     
     # client calculates response
     res = hashlib.sha1(c + "pwdhash").hexdigest()
     
     # check response
     v = a.validate(c, "uid", res)
     self.assertFalse(v)
开发者ID:stereohead,项目名称:wsgi-cahin,代码行数:16,代码来源:tests.py

示例12: ajaxpost

    def ajaxpost(self, url, data):
        try:
            data
        except:
            data = {}
        try:
            self.auth = Auth()
            self.cookie = self.auth.get_cookies()

            if(self.cookie != None):
                self.cookie.set('mycook', self.currentFingerPrint['hash'])

            if(self.noAuthCookie != None):
                try:
                    self.noAuthCookie.set('mycook', self.currentFingerPrint['hash'])
                except:
                    pass

            reqCookie = self.noAuthCookie if self.cookie==None else self.cookie
            headers = {
                'Referer' : SITE_URL,
                'X-Requested-With'  : 'XMLHttpRequest',
                'User-agent' : self.currentFingerPrint['useragent']
            }
            response = xbmcup.net.http.post(url, data, cookies=reqCookie, headers=headers)
            #After saving the fingerprint, you do not need to remember cookies
            if(url != SITE_URL+'/film/index/imprint'):
                self.noAuthCookie = response.cookies
        except xbmcup.net.http.exceptions.RequestException:
            print traceback.format_exc()
            return None
        else:
            if(response.status_code == 200):
                return response.text
            return None
开发者ID:evgen-dev,项目名称:repository.evgen_dev.xbmc-addons,代码行数:35,代码来源:http.py

示例13: ajax

    def ajax(self, url):
        self.currentFingerPrint = self.getFingerPrint()
        try:
            self.auth = Auth()
            self.cookie = self.auth.get_cookies()

            if(self.cookie != None):
                self.cookie.set('mycook', self.currentFingerPrint['hash'])

            if(self.noAuthCookie != None):
                try:
                    self.noAuthCookie.set('mycook', self.currentFingerPrint['hash'])
                except:
                    pass

            reqCookie = self.noAuthCookie if self.cookie==None else self.cookie
            headers = {
                'X-Requested-With'  : 'XMLHttpRequest',
                'Referer'           : SITE_URL,
                'User-agent'        : self.currentFingerPrint['useragent']
            }
            response = xbmcup.net.http.get(url, cookies=reqCookie, headers=headers)
            self.noAuthCookie = response.cookies
        except xbmcup.net.http.exceptions.RequestException:
            print traceback.format_exc()
            return None
        else:
            return response.text if response.status_code == 200 else None
开发者ID:evgen-dev,项目名称:repository.evgen_dev.xbmc-addons,代码行数:28,代码来源:http.py

示例14: info

    def info(inData):
        from auth import Auth
        pureData=Sensor.select(inData)

        stationInfo={}
        authInfo={}
        userInfo={}

        stationQuery=session.query(Station)
        authQuery=session.query(Auth)
        userQuery=session.query(User)
        for tmp in pureData['data']:
            t=tmp['stationId']

            tmpAllStation=Station.select({'id': int(t)})
            if(len(tmpAllStation['data'])==0):
                tmp['stationName']='not find'
            else:
                tmp['stationName']=tmpAllStation['data'][0]['name']

            tmpAllAuth=Auth.select({'sensorId': int(tmp['id'])})
            if(len(tmpAllAuth['data'])==0):
                tmp['username']='not find'
                tmp['userId']=-1
            else:
                tmpAllUser=User.select({'id': int(tmpAllAuth['data'][0]['userId'])})
                if(len(tmpAllUser['data'])==0):
                    tmp['username']='not find'
                    tmp['userId']=-1
                else:
                    tmp['username']=tmpAllUser['data'][0]['username']
                    tmp['userId']=tmpAllUser['data'][0]['id']

        return pureData
开发者ID:wncbb,项目名称:trainWeb,代码行数:34,代码来源:sensor.py

示例15: post

 def post(self, url, data):
     self.currentFingerPrint = self.getFingerPrint()
     try:
         data
     except:
         data = {}
     try:
         self.auth = Auth()
         self.cookie = self.auth.get_cookies()
         reqCookie = self.noAuthCookie if self.cookie==None else self.cookie
         headers = {
             'Referer' : url,
             'User-agent' : self.currentFingerPrint['useragent']
         }
         response = xbmcup.net.http.post(url, data, cookies=reqCookie, headers=headers)
         self.noAuthCookie = response.cookies
     except xbmcup.net.http.exceptions.RequestException:
         print traceback.format_exc()
         return None
     else:
         if(response.status_code == 200):
             if(self.auth.check_auth(response.text) == False):
                 self.auth.autorize()
             return response.text
         return None
开发者ID:evgen-dev,项目名称:repository.evgen_dev.xbmc-addons,代码行数:25,代码来源:http.py


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