mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
Update operation log middleware info reading (#368)
* Fix operation log middleware summary reading * update ua info and ip info * update opera middle functions * move dataclasses.py * fix lint
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
import dataclasses
|
||||
|
||||
from fastapi import Response
|
||||
|
||||
from backend.common.enums import StatusType
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class IpInfo:
|
||||
ip: str
|
||||
country: str | None
|
||||
region: str | None
|
||||
city: str | None
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class UserAgentInfo:
|
||||
user_agent: str
|
||||
os: str | None
|
||||
browser: str | None
|
||||
device: str | None
|
||||
|
||||
|
||||
@dataclasses.dataclass
|
||||
class RequestCallNextReturn:
|
||||
code: str
|
||||
msg: str
|
||||
status: StatusType
|
||||
err: Exception | None
|
||||
response: Response
|
||||
Reference in New Issue
Block a user