當前位置: 首頁>>代碼示例>>Python>>正文


Python auth.authenticate方法代碼示例

本文整理匯總了Python中auth.authenticate方法的典型用法代碼示例。如果您正苦於以下問題:Python auth.authenticate方法的具體用法?Python auth.authenticate怎麽用?Python auth.authenticate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在auth的用法示例。


在下文中一共展示了auth.authenticate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: on_post

# 需要導入模塊: import auth [as 別名]
# 或者: from auth import authenticate [as 別名]
def on_post(self, req, resp):
        validRequest = authenticate(req)

        if not validRequest:
            resp.body = "Invalid username/password"
            resp.status = falcon.HTTP_401
            return

        session = Session(engine)
        valueDict = getJson(req)

        signatureQuery = getSignatureQuery(req, session)

        message = "Unable to add Signature"
        resp.status = falcon.HTTP_400

        if "Signature" in valueDict.keys() and signatureQuery is None:
            signatureRow = createSignatureRow(session, valueDict)
            message = "Unable to create signature row"
            if signatureRow is not None:
                session.add(signatureRow)
                message = "Added signature to database: {}".format(signatureRow.PrimaryKey)
                resp.status = falcon.HTTP_200

        elif "Signature" in valueDict.keys():
            message = "Unable to add Signature, already exists in database"

        resp.body = message
        print(message)

        session.commit()
        session.close() 
開發者ID:pyskell,項目名稱:LicenseServer,代碼行數:34,代碼來源:insert.py

示例2: main

# 需要導入模塊: import auth [as 別名]
# 或者: from auth import authenticate [as 別名]
def main():

    # Please notice that you need to put in your client id and client secret in demo/auth.py in order to make this work.
    oauth, _, _ = authenticate()
    run_examples(oauth)
    os._exit(0) 
開發者ID:box,項目名稱:box-python-sdk,代碼行數:8,代碼來源:example.py


注:本文中的auth.authenticate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。