Last active
April 3, 2021 14:43
-
-
Save stefanw/a9650b30d5eb4b9808e00d3fad0c1750 to your computer and use it in GitHub Desktop.
mitmproxy script to accelerate vaccination appointment page. Replace ... with content from API.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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