Skip to content

Instantly share code, notes, and snippets.

@stefanw
Last active April 3, 2021 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stefanw/a9650b30d5eb4b9808e00d3fad0c1750 to your computer and use it in GitHub Desktop.
Save stefanw/a9650b30d5eb4b9808e00d3fad0c1750 to your computer and use it in GitHub Desktop.
mitmproxy script to accelerate vaccination appointment page. Replace ... with content from API.
from mitmproxy import http
OK_URL = 'https://termin.corona-impfung.nrw/api/impfling/buchung/backend/ok'
LIST_URL = 'https://termin.corona-impfung.nrw/api/impfzentrum/list'
STATUS_URL = 'https://termin.corona-impfung.nrw/api/impfling/buchung/status'
BENUTZER_URL = 'https://termin.corona-impfung.nrw/api/benutzer/benutzer'
def request(flow: http.HTTPFlow) -> None:
if flow.request.pretty_url == OK_URL:
flow.response = http.HTTPResponse.make(
200, # (optional) status code
b"true", # (optional) content
{} # (optional) headers
)
if flow.request.pretty_url == LIST_URL:
flow.response = http.HTTPResponse.make(
200,
'...'.encode('utf-8'),
{"Content-Type": "application/json; charset=utf-8"}
)
if flow.request.pretty_url == STATUS_URL:
flow.response = http.HTTPResponse.make(
200,
b'...',
{"Content-Type": "application/json; charset=utf-8"}
)
if flow.request.pretty_url == BENUTZER_URL:
flow.response = http.HTTPResponse.make(
200,
'...'.encode('utf-8'),
{"Content-Type": "application/json; charset=utf-8"}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment