This endpoint allows you to execute Python code remotely. By sending your Python script to the specified URL, you will receive the execution results directly back. It’s a convenient way to test and run Python scripts without needing a local Python environment.
Endpoint Information
- Method: POST
- Endpoint URL: https://node.nodetrigger.com/api/execute-python
- Content Type: application/json
Example Requests
To use this endpoint, send a POST request with your Python code in the body using JSON format. Here is an example:
{
"code": "print('Hello, World!')"
}
Notes
- Ensure that your request body contains the Python code you wish to execute, formatted as JSON. The JSON key should be
code
and the value should be your Python script as a string. - If the Python code is not provided in the request, you will receive an error message stating “No Python code provided”. Make sure to include the code to avoid this error.
- In case of any issues during the execution of the Python code, a response with a status code of 500 will be returned, along with an error message.
- This endpoint does not support any other methods besides POST. Using any other HTTP method will result in an error.
“`