[feat] pprint inbox log
This commit is contained in:
parent
157073a4a7
commit
632e10c956
1 changed files with 8 additions and 1 deletions
|
@ -5,15 +5,22 @@ from flask import Request, abort
|
||||||
from demo.httpsig import HttpSignature, SignedData
|
from demo.httpsig import HttpSignature, SignedData
|
||||||
from demo.actor import fetch_actor
|
from demo.actor import fetch_actor
|
||||||
from app import logger
|
from app import logger
|
||||||
|
from pprint import pformat
|
||||||
|
|
||||||
|
|
||||||
def inbox_prechecker(
|
def inbox_prechecker(
|
||||||
request: Request,
|
request: Request,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Inbox request prechecker"""
|
"""Inbox request prechecker"""
|
||||||
|
try:
|
||||||
|
json_payload = request.json
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
abort(401, "no activity+json request!")
|
||||||
|
|
||||||
headers = request.headers
|
headers = request.headers
|
||||||
payload = request.data
|
payload = request.data
|
||||||
logger.debug(f"new request {payload=}\n{headers=}")
|
logger.info(f"new request \n{pformat(json_payload)}\n{pformat({k: v for k, v in request.headers})}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parsed_signature = HttpSignature.parse_signature(
|
parsed_signature = HttpSignature.parse_signature(
|
||||||
headers["signature"]
|
headers["signature"]
|
||||||
|
|
Loading…
Reference in a new issue