Update decorators.py

This commit is contained in:
Arc 2020-04-16 12:03:00 +01:00 committed by GitHub
parent abc694307a
commit 764fde012c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,9 +13,9 @@ def api_check_wallet_macaroon(*, key_type: str = "invoice"):
@wraps(view)
def wrapped_view(**kwargs):
try:
g.wallet = get_wallet_for_key(request.headers["Grpc-Metadata-macaroon"], key_type)
g.wallet = get_wallet_for_key(request.headers["api_key"], key_type)
except KeyError:
return jsonify({"message": "`Grpc-Metadata-macaroon` header missing."}), Status.BAD_REQUEST
return jsonify({"message": "`api_key` header missing."}), Status.BAD_REQUEST
if not g.wallet:
return jsonify({"message": "Wrong keys."}), Status.UNAUTHORIZED