Skip to content

Instantly share code, notes, and snippets.

@plu
Created December 21, 2016 09:50
Show Gist options
  • Save plu/d28763bbe0313922adf936079e217b3e to your computer and use it in GitHub Desktop.
Save plu/d28763bbe0313922adf936079e217b3e to your computer and use it in GitHub Desktop.
from mitmproxy import ctx
from mitmproxy.models import decoded
import codecs
import json
class Duolingo:
def response(self, flow):
if "/api/1/version_info" not in flow.request.url:
return
data = json.loads(flow.response.content.decode('utf-8'))
data["supported_directions"]["en"] = data["supported_directions"]["en"] + ["ro"]
flow.response.content = str.encode(json.dumps(data))
def start():
return Duolingo()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment