-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
first draft of read har. #6190
first draft of read har. #6190
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! Lots of feedback below, please extrapolate from my comments to the rest of your code! 😃
examples/contrib/readhar.py
Outdated
self.running() | ||
self._read_har_task |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This here can be greatly simplified I think. You can just do this here instead and avoid the functions above:
self.running() | |
self._read_har_task | |
async def load_flows() -> None: | |
for flow in flows: | |
await ctx.master.load_flow(flow) | |
asyncio.create_task(load_flows()) |
The main underlying problem here is that commands cannot be async yet, otherwise we could just call await ctx.master.load_flow(flow)
directly.
Thanks! Your feedback was super helpful! Here is the updated version of my code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Progress! 🚀
examples/contrib/readhar.py
Outdated
) | ||
|
||
# 375:3 is default mitmproxy server_conn when making a new flow. | ||
server_conn = connection.Server(address=("375", 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't comment and code here. Can you explain? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Please make sure that CI is passing (https://github.com/mitmproxy/mitmproxy/actions/runs/5405361567/jobs/9820804825), and then this is good to go! 😃
…into import-har
…into import-har
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Head branch was pushed to by a user without write access
* first draft of read har. * [autofix.ci] apply automated fixes * Fixed using max's suggestions * [autofix.ci] apply automated fixes * updated to snake_case * [autofix.ci] apply automated fixes * Made max's changes. * [autofix.ci] apply automated fixes * gets server address from har file now * [autofix.ci] apply automated fixes * added support for if serverIPAdress wasnt found * [autofix.ci] apply automated fixes * editted docstring and changed peername and sockname values * fix nits * removed unused variable, should pass tox --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Maximilian Hils <git@maximilianhils.com>
Description
Added readhar to examples/contrib. Reads har files into mitmproxy.