question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Write API Documentation

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
SamJoancommented, Jun 2, 2021

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

1reaction
Kriechicommented, May 19, 2018

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!).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found