Skip to content

Instantly share code, notes, and snippets.

@bavis-m
Last active Sep 27, 2021
Embed
What would you like to do?
import json
additions = []
try:
additionsFile = open("/home/mitmproxy/.mitmproxy/scene_renames.json", "r")
additions = json.load(additionsFile)
additionsFile.close()
except:
additions = []
print(json.dumps(additions))
def response(flow):
print(flow.request.pretty_url)
mapping = False
try:
mapping = flow.request.pretty_url.index("https://services.sonarr.tv/v1/scenemapping") == 0
except:
pass
if mapping:
data = json.loads(flow.response.text)
merged = data + additions
flow.response.text = json.dumps(merged)
del flow.response.headers["Content-Length"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment