Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Launch proxy",
"type": "process",
"command": "${command:python.interpreterPath}",
"args": [
"scripts${/}proxy_lp.py"
],
"isBackground": true,
"presentation": {
"reveal": "always",
"panel": "dedicated"
},
"problemMatcher": [],
"detail": "python3 scripts/proxy_lp.py",
"runOptions": {
"instanceLimit": 1,
"instancePolicy": "terminateOldest"
}
}
]
}
25 changes: 23 additions & 2 deletions scripts/proxy_lp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import asyncio

from http import HTTPStatus
from mitmproxy import http

from mitmproxy import addons, http, master
from mitmproxy.addons import dumper, errorcheck, keepserving, readfile


class LiquipediaMapper:
Expand Down Expand Up @@ -41,4 +45,21 @@ def __serve_local_js_resource(self, flow: http.HTTPFlow):
)


addons = [LiquipediaMapper()]
async def main():
m = master.Master(None)
m.addons.add(
*addons.default_addons(),
LiquipediaMapper(),
dumper.Dumper(),
keepserving.KeepServing(),
readfile.ReadFileStdin(),
errorcheck.ErrorCheck(),
)
try:
await m.run()
except asyncio.CancelledError:
await m.done()


if __name__ == "__main__":
asyncio.run(main())
Loading