Write API Documentation
See original GitHub issueI’m raising this issue because its not listed in https://github.com/mitmproxy/mitmproxy/issues/2895
There is practically no API documentation. I am currently studying machine generated diagrams to try to understand how this works. Its no fun.
Somebody wrote “You can either run mitmdump as a regular process and send it a Ctrl+C when you are finished (importing mitmdump from mitmproxy.tools.main would work as well), or you instantiate your own DumpMaster and thenn call master.shutdown() when you are finished.” at https://discourse.mitmproxy.org/t/start-and-stop-mitmproxy-from-python-script/677.
The homepage boasts a screenshot showing this:
from mitmproxy import http
def request(flow: http.HTTPFlow):
# redirect to different host
if flow.request.pretty_host == "example.com":
flow.request.host = "mitmproxy.org"
# answer from proxy
elif flow.request.path.endswith("/brew"):
flow.response = http.HTTPResponse.make(
418, b"I'm a teapot",
)`
Its not much to go on.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:11 (6 by maintainers)
Top Results From Across the Web
How to Write API Documentation: Best Practices and Examples
What Developers Hate in API Documentation · Adopt spec-driven development · Write for the entry level · Incorporate must-have sections · Use ...
Read more >What Is API Documentation? [+ How to Write and Read It]
How to Write API Documentation · Understand the API's users. · Map out the user journey. · Start with the fundamentals. · Add...
Read more >10 Ways to Create Easy-to-Use, Compelling API Documentation
1. Tell a Big Story · 2. Provide a Clear Starting Point · 3. Create a Structure that Facilitates Common Use Cases ·...
Read more >Documenting APIs: A guide for technical writers and engineers
In this course on writing documentation for APIs, instead of just talking about abstract concepts, I contextualize APIs with a direct, hands-on approach....
Read more >API Documentation Guide and Best Practices - Stoplight
API docs, or API description documents, are the collection of references, tutorials, and examples that help developers use your API. Your API's documentation...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I asked on slack and was told the docs will hit stable soon, in the meantime they can be accessed at https://docs.mitmproxy.org/dev/api/mitmproxy/http.html
What you are looking for is listed as
Addon development docs, mentioning hot reload and testing
. Yes, we are lacking decent docs!Let me give you a few pointers that might help you: Generally speaking, in most cases you want to write an “addon”. https://docs.mitmproxy.org/stable/addons-overview/
This is what we provide as a single script to start with mitmproxy (or mitmdump), and it can react to certain events in the lifecycle of your traffic going through the proxy. https://docs.mitmproxy.org/stable/addons-events/ https://docs.mitmproxy.org/stable/addons-scripting/
Also, take a look at our examples folder (matching your mitmproxy release!).