From fe13df57caf6f0777bdd247fd5c23b5364a22d86 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Fri, 22 Dec 2023 17:58:08 +1100 Subject: [PATCH] Send function name to isolator when executing code so it can be accessed as a variable from within side the script --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index d884fe1..9ddbf72 100644 --- a/app.py +++ b/app.py @@ -36,7 +36,7 @@ class User(UserMixin): return None -API_URL = 'https://isolator.peterstockings.com/execute' +API_URL = 'https://isolator.peterstockings.com/execute' #'http://127.0.0.1:5000/execute' DEFAULT_FUNCTION_NAME = 'foo' @@ -212,7 +212,7 @@ def execute_code(): environment_json = json.loads(environment) # Call the Node.js API - response = requests.post(API_URL, json={'code': code, 'request': request_obj, 'environment': environment_json}) + response = requests.post(API_URL, json={'code': code, 'request': request_obj, 'environment': environment_json, 'name': "anonymous"}) response_data = response.json() # check if playground=true is in the query string @@ -277,7 +277,7 @@ def execute_http_function(user_id, function): request_data['text'] = request.data.decode('utf-8') # Call the Node.js API - response = requests.post(API_URL, json={'code': code, 'request': request_data, 'environment': environment}) + response = requests.post(API_URL, json={'code': code, 'request': request_data, 'environment': environment, 'name': function_name}) response_data = response.json() db.update_http_function_environment_info_and_invoked_count(user_id, function_name, response_data['environment'])