remove mention of ctx.log from addon example (#6552)
[#5590](https://github.com/mitmproxy/mitmproxy/pull/5590) made the switch to standard logging, but this part of the addons documentation references the previous `ctx.log` approach.
This commit is contained in:
parent
a9b8a00b70
commit
ae00e82c3a
24
CHANGELOG.md
24
CHANGELOG.md
|
@ -1,12 +1,14 @@
|
||||||
# Release History
|
# Release History
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
✨ Please add a bullet point describing your change. ✨
|
✨ Please add a bullet point describing your change. ✨
|
||||||
✨ You do not need to add a pull request reference or author information, this will be done automatically by CI. ✨
|
✨ You do not need to add a pull request reference or author information, this will be done automatically by CI. ✨
|
||||||
-->
|
-->
|
||||||
|
|
||||||
## Unreleased: mitmproxy next
|
## Unreleased: mitmproxy next
|
||||||
|
|
||||||
|
* Remove stale reference to `ctx.log` in addon documentation.
|
||||||
|
([#6552](https://github.com/mitmproxy/mitmproxy/pull/6552), @brojonat)
|
||||||
* Fix a bug where a traceback is shown during shutdown.
|
* Fix a bug where a traceback is shown during shutdown.
|
||||||
([#6581](https://github.com/mitmproxy/mitmproxy/pull/6581), @mhils)
|
([#6581](https://github.com/mitmproxy/mitmproxy/pull/6581), @mhils)
|
||||||
|
|
||||||
|
@ -136,7 +138,7 @@
|
||||||
details.
|
details.
|
||||||
- On Windows, `mitmproxy-rs` now depends on `mitmproxy-windows`. We only provide binary wheels for this package to
|
- On Windows, `mitmproxy-rs` now depends on `mitmproxy-windows`. We only provide binary wheels for this package to
|
||||||
simplify our deployment process, see CI for how to build from source.
|
simplify our deployment process, see CI for how to build from source.
|
||||||
|
|
||||||
([#6303](https://github.com/mitmproxy/mitmproxy/issues/6303), @mhils)
|
([#6303](https://github.com/mitmproxy/mitmproxy/issues/6303), @mhils)
|
||||||
* Increase maximum dump file size accepted by mitmweb
|
* Increase maximum dump file size accepted by mitmweb
|
||||||
([#6373](https://github.com/mitmproxy/mitmproxy/pull/6373), @t-wy)
|
([#6373](https://github.com/mitmproxy/mitmproxy/pull/6373), @t-wy)
|
||||||
|
@ -146,7 +148,7 @@
|
||||||
|
|
||||||
* Add experimental support for HTTP/3 and QUIC.
|
* Add experimental support for HTTP/3 and QUIC.
|
||||||
([#5435](https://github.com/mitmproxy/mitmproxy/issues/5435), @meitinger)
|
([#5435](https://github.com/mitmproxy/mitmproxy/issues/5435), @meitinger)
|
||||||
* ASGI/WSGI apps can now listen on all ports for a specific hostname.
|
* ASGI/WSGI apps can now listen on all ports for a specific hostname.
|
||||||
This makes it simpler to accept both HTTP and HTTPS.
|
This makes it simpler to accept both HTTP and HTTPS.
|
||||||
([#5725](https://github.com/mitmproxy/mitmproxy/pull/5725), @mhils)
|
([#5725](https://github.com/mitmproxy/mitmproxy/pull/5725), @mhils)
|
||||||
* Add `replay.server.add` command for adding flows to server replay buffer
|
* Add `replay.server.add` command for adding flows to server replay buffer
|
||||||
|
@ -218,7 +220,7 @@
|
||||||
([#5414](https://github.com/mitmproxy/mitmproxy/pull/5414), @meitinger)
|
([#5414](https://github.com/mitmproxy/mitmproxy/pull/5414), @meitinger)
|
||||||
* Add WireGuard mode to enable transparent proxying via WireGuard.
|
* Add WireGuard mode to enable transparent proxying via WireGuard.
|
||||||
([#5562](https://github.com/mitmproxy/mitmproxy/pull/5562), @decathorpe, @mhils)
|
([#5562](https://github.com/mitmproxy/mitmproxy/pull/5562), @decathorpe, @mhils)
|
||||||
* Add DTLS support.
|
* Add DTLS support.
|
||||||
([#5397](https://github.com/mitmproxy/mitmproxy/pull/5397), @kckeiks).
|
([#5397](https://github.com/mitmproxy/mitmproxy/pull/5397), @kckeiks).
|
||||||
* Add a quick help bar to mitmproxy.
|
* Add a quick help bar to mitmproxy.
|
||||||
([#5381](https://github.com/mitmproxy/mitmproxy/pull/5381/), [#5652](https://github.com/mitmproxy/mitmproxy/pull/5652), @kckeiks, @mhils).
|
([#5381](https://github.com/mitmproxy/mitmproxy/pull/5381/), [#5652](https://github.com/mitmproxy/mitmproxy/pull/5652), @kckeiks, @mhils).
|
||||||
|
@ -231,7 +233,7 @@
|
||||||
* Deprecate `mitmproxy.ctx.log` in favor of Python's builtin `logging` module.
|
* Deprecate `mitmproxy.ctx.log` in favor of Python's builtin `logging` module.
|
||||||
See [the docs](https://docs.mitmproxy.org/dev/addons-api-changelog/) for details and upgrade instructions.
|
See [the docs](https://docs.mitmproxy.org/dev/addons-api-changelog/) for details and upgrade instructions.
|
||||||
([#5590](https://github.com/mitmproxy/mitmproxy/pull/5590), @mhils)
|
([#5590](https://github.com/mitmproxy/mitmproxy/pull/5590), @mhils)
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
* The `mode` option is now a list of server specs instead of a single spec.
|
* The `mode` option is now a list of server specs instead of a single spec.
|
||||||
|
@ -248,7 +250,7 @@
|
||||||
([#5623](https://github.com/mitmproxy/mitmproxy/issues/5623), @SapiensAnatis)
|
([#5623](https://github.com/mitmproxy/mitmproxy/issues/5623), @SapiensAnatis)
|
||||||
* Add MQTT content view.
|
* Add MQTT content view.
|
||||||
([#5588](https://github.com/mitmproxy/mitmproxy/pull/5588), @nikitastupin, @abbbe)
|
([#5588](https://github.com/mitmproxy/mitmproxy/pull/5588), @nikitastupin, @abbbe)
|
||||||
* Setting `connection_strategy` to `lazy` now also disables early
|
* Setting `connection_strategy` to `lazy` now also disables early
|
||||||
upstream connections to fetch TLS certificate details.
|
upstream connections to fetch TLS certificate details.
|
||||||
([#5487](https://github.com/mitmproxy/mitmproxy/pull/5487), @mhils)
|
([#5487](https://github.com/mitmproxy/mitmproxy/pull/5487), @mhils)
|
||||||
* Fix order of event hooks on startup.
|
* Fix order of event hooks on startup.
|
||||||
|
@ -318,7 +320,7 @@
|
||||||
([#4469](https://github.com/mitmproxy/mitmproxy/issues/4469), @mhils)
|
([#4469](https://github.com/mitmproxy/mitmproxy/issues/4469), @mhils)
|
||||||
* Add flatpak support to the browser addon
|
* Add flatpak support to the browser addon
|
||||||
([#5200](https://github.com/mitmproxy/mitmproxy/issues/5200), @pauloromeira)
|
([#5200](https://github.com/mitmproxy/mitmproxy/issues/5200), @pauloromeira)
|
||||||
* Add example addon to dump contents to files based on a filter expression
|
* Add example addon to dump contents to files based on a filter expression
|
||||||
([#5190](https://github.com/mitmproxy/mitmproxy/issues/5190), @redraw)
|
([#5190](https://github.com/mitmproxy/mitmproxy/issues/5190), @redraw)
|
||||||
* Fix a bug where the wrong SNI is sent to an upstream HTTPS proxy
|
* Fix a bug where the wrong SNI is sent to an upstream HTTPS proxy
|
||||||
([#5109](https://github.com/mitmproxy/mitmproxy/issues/5109), @mhils)
|
([#5109](https://github.com/mitmproxy/mitmproxy/issues/5109), @mhils)
|
||||||
|
@ -328,14 +330,14 @@
|
||||||
([#5217](https://github.com/mitmproxy/mitmproxy/issues/5217), @randomstuff)
|
([#5217](https://github.com/mitmproxy/mitmproxy/issues/5217), @randomstuff)
|
||||||
* Improve cut addon to better handle binary contents
|
* Improve cut addon to better handle binary contents
|
||||||
([#3965](https://github.com/mitmproxy/mitmproxy/issues/3965), @mhils)
|
([#3965](https://github.com/mitmproxy/mitmproxy/issues/3965), @mhils)
|
||||||
* Fix text truncation for full-width characters
|
* Fix text truncation for full-width characters
|
||||||
([#4278](https://github.com/mitmproxy/mitmproxy/issues/4278), @kjy00302)
|
([#4278](https://github.com/mitmproxy/mitmproxy/issues/4278), @kjy00302)
|
||||||
* Fix mitmweb export copy failed in non-secure domain.
|
* Fix mitmweb export copy failed in non-secure domain.
|
||||||
([#5264](https://github.com/mitmproxy/mitmproxy/issues/5264), @Pactortester)
|
([#5264](https://github.com/mitmproxy/mitmproxy/issues/5264), @Pactortester)
|
||||||
* Add example script for manipulating cookies.
|
* Add example script for manipulating cookies.
|
||||||
([#5278](https://github.com/mitmproxy/mitmproxy/issues/5278), @WillahScott)
|
([#5278](https://github.com/mitmproxy/mitmproxy/issues/5278), @WillahScott)
|
||||||
* When opening an external viewer for message contents, mailcap files are not considered anymore.
|
* When opening an external viewer for message contents, mailcap files are not considered anymore.
|
||||||
This preempts the upcoming deprecation of Python's `mailcap` module.
|
This preempts the upcoming deprecation of Python's `mailcap` module.
|
||||||
([#5297](https://github.com/mitmproxy/mitmproxy/issues/5297), @KORraNpl)
|
([#5297](https://github.com/mitmproxy/mitmproxy/issues/5297), @KORraNpl)
|
||||||
* Fix hostname encoding for IDNA domains in upstream mode.
|
* Fix hostname encoding for IDNA domains in upstream mode.
|
||||||
([#5316](https://github.com/mitmproxy/mitmproxy/issues/5316), @nneonneo)
|
([#5316](https://github.com/mitmproxy/mitmproxy/issues/5316), @nneonneo)
|
||||||
|
@ -396,7 +398,7 @@
|
||||||
* Add ability to specify custom ports with LDAP authentication (#5068, @demonoidvk)
|
* Add ability to specify custom ports with LDAP authentication (#5068, @demonoidvk)
|
||||||
* Add support for rotating saved streams every hour or day (@EndUser509)
|
* Add support for rotating saved streams every hour or day (@EndUser509)
|
||||||
* Console Improvements on Windows (@mhils)
|
* Console Improvements on Windows (@mhils)
|
||||||
* Fix processing of `--set` options (#5067, @marwinxxii)
|
* Fix processing of `--set` options (#5067, @marwinxxii)
|
||||||
* Lowercase user-added header names and emit a log message to notify the user when using HTTP/2 (#4746, @mhils)
|
* Lowercase user-added header names and emit a log message to notify the user when using HTTP/2 (#4746, @mhils)
|
||||||
* Exit early if there are errors on startup (#4544, @mhils)
|
* Exit early if there are errors on startup (#4544, @mhils)
|
||||||
* Fixed encoding guessing: only search for meta tags in HTML bodies (##4566, @Prinzhorn)
|
* Fixed encoding guessing: only search for meta tags in HTML bodies (##4566, @Prinzhorn)
|
||||||
|
|
|
@ -25,9 +25,9 @@ them to keys in the interactive tools.
|
||||||
{{< example src="examples/addons/anatomy.py" lang="py" >}}
|
{{< example src="examples/addons/anatomy.py" lang="py" >}}
|
||||||
|
|
||||||
Above is a simple addon that keeps track of the number of flows (or more
|
Above is a simple addon that keeps track of the number of flows (or more
|
||||||
specifically HTTP requests) we've seen. Every time it sees a new flow, it uses
|
specifically HTTP requests) we've seen. Every time it sees a new flow, it
|
||||||
mitmproxy's internal logging mechanism to announce its tally. The output can be
|
increments and logs its tally. The output can be found in the event log in the
|
||||||
found in the event log in the interactive tools, or on the console in mitmdump.
|
interactive tools, or on the console in mitmdump.
|
||||||
|
|
||||||
Take it for a spin and make sure that it does what it's supposed to, by loading
|
Take it for a spin and make sure that it does what it's supposed to, by loading
|
||||||
it into your mitmproxy tool of choice. We'll use mitmdump in these examples,
|
it into your mitmproxy tool of choice. We'll use mitmdump in these examples,
|
||||||
|
@ -45,11 +45,6 @@ Here are a few things to note about the code above:
|
||||||
- The `request` method is an example of an *event*. Addons simply implement a
|
- The `request` method is an example of an *event*. Addons simply implement a
|
||||||
method for each event they want to handle. Each event and its signature are documented
|
method for each event they want to handle. Each event and its signature are documented
|
||||||
in the [API documentation]({{< relref "addons-api" >}}).
|
in the [API documentation]({{< relref "addons-api" >}}).
|
||||||
- Finally, the `ctx` module is a holdall module that exposes a set of standard
|
|
||||||
objects that are commonly used in addons. We could pass a `ctx` object as the
|
|
||||||
first parameter to every event, but we've found it neater to just expose it as
|
|
||||||
an importable global. In this case, we're using the `ctx.log` object to do our
|
|
||||||
logging.
|
|
||||||
|
|
||||||
# Abbreviated Scripting Syntax
|
# Abbreviated Scripting Syntax
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ if typing.TYPE_CHECKING:
|
||||||
import mitmproxy.master
|
import mitmproxy.master
|
||||||
import mitmproxy.options
|
import mitmproxy.options
|
||||||
|
|
||||||
log: mitmproxy.log.Log
|
|
||||||
master: mitmproxy.master.Master
|
master: mitmproxy.master.Master
|
||||||
options: mitmproxy.options.Options
|
options: mitmproxy.options.Options
|
||||||
|
|
||||||
|
log: mitmproxy.log.Log
|
||||||
|
"""Deprecated: Use Python's builtin `logging` module instead."""
|
||||||
|
|
Loading…
Reference in New Issue