Send function name to isolator when executing code so it can be accessed as a variable from within side the script
This commit is contained in:
6
app.py
6
app.py
@@ -36,7 +36,7 @@ class User(UserMixin):
|
|||||||
return None
|
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'
|
DEFAULT_FUNCTION_NAME = 'foo'
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ def execute_code():
|
|||||||
environment_json = json.loads(environment)
|
environment_json = json.loads(environment)
|
||||||
|
|
||||||
# Call the Node.js API
|
# 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()
|
response_data = response.json()
|
||||||
|
|
||||||
# check if playground=true is in the query string
|
# 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')
|
request_data['text'] = request.data.decode('utf-8')
|
||||||
|
|
||||||
# Call the Node.js API
|
# 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()
|
response_data = response.json()
|
||||||
|
|
||||||
db.update_http_function_environment_info_and_invoked_count(user_id, function_name, response_data['environment'])
|
db.update_http_function_environment_info_and_invoked_count(user_id, function_name, response_data['environment'])
|
||||||
|
|||||||
Reference in New Issue
Block a user