Python code:

# post request @ local_service. The route (' serverName/postInterfaceName ', methods=['POST']) @cross_origin(supports_credentials=True) def post_interface_name(): # # read json file as a return path = OS. The path. The dirname (OS) path) dirname (OS) path) abspath (__file__))) + '/ jsonFile jsonFileName. Json' with open(path, 'r', encoding='utf')as fp: Response = json. Load (fp) return response # get request @local_service.route('/system/time', methods=['GET']) @cross_origin(supports_credentials=True) def get_interface_name(): time = {"success": True, "code": "8000", "result": 1625068800000} time_map = json.dumps(time, sort_keys=True, indent=4, separators=(',', ': ')) return time_map if __name__ == '__main__': local_service.run(port=8890, debug=True, host='127.0.0.1')

Charles Settings:

Right click on the interface you want to mock –>Map remote– > select Protocol and enter the Host Port Path– >OK

This interface takes the local mock data every time the system calls it