本文整理汇总了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()
示例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)