Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add operation log related interfaces #92

Merged
merged 9 commits into from
Jun 5, 2023

Conversation

wu-clan
Copy link
Member

@wu-clan wu-clan commented Jun 3, 2023

There is a problem with this middleware that needs to be addressed.

WIP.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

I have tried some efforts, but there seems to be a problem with using request bodies in middleware for Starlette version 0.27.0, see encode/starlette#2026 for details.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

I think it is possible to merge this PR ahead of time, provided that the problematic code is commented out and a new PR is opened to fix it after Starlette is updated.

@wu-clan wu-clan requested a review from downdawn June 5, 2023 05:37
@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

Hi, @downdawn

Any ideas?

@downdawn
Copy link
Collaborator

downdawn commented Jun 5, 2023

No problem.

I suggest keeping the MIDDLEWARE_ACCESS because this middleware has become complex now and there may be some unknown issues.

@downdawn
Copy link
Collaborator

downdawn commented Jun 5, 2023

Some native methods.

user_agent = request.headers.get('User-Agent')
_user_agent = parse(user_agent)
device = _user_agent.get_device()
os = _user_agent.get_os()
browser = _user_agent.get_browser()

backend/app/middleware/opera_log_middleware.py Outdated Show resolved Hide resolved
@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

No problem.

I suggest keeping the MIDDLEWARE_ACCESS because this middleware has become complex now and there may be some unknown issues.

I will restore it.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

Some native methods.

user_agent = request.headers.get('User-Agent')
_user_agent = parse(user_agent)
device = _user_agent.get_device()
os = _user_agent.get_os()
browser = _user_agent.get_browser()

No problem at all.

@wu-clan
Copy link
Member Author

wu-clan commented Jun 5, 2023

TBR.

@wu-clan wu-clan requested a review from downdawn June 5, 2023 09:17
@downdawn downdawn merged commit 627208b into fastapi-practices:master Jun 5, 2023
@wu-clan wu-clan deleted the add-opera-log branch June 5, 2023 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants