Piston - acm-mu/abacus GitHub Wiki

Piston

acm-mu/piston (forked from engineer-man/piston)

The Piston API service is used to test submissions for the Blue division. It is forked from engineer-man with a few modifications.

Execute Endpoint

Example Request

POST /execute This endpoint requests execution of some arbitrary code.

  • language: (required) The language to use for execution, must be a string and supported by Piston (see list on engineer-man/piston).
  • source: (required) The source code to execute, must be a string.
  • stdin: (optional) The text to pass as stdin to the program. Must be a string or left out of the request.
  • timeout: (optional) How long (in seconds) before the execution should timeout. Default 3 seconds.
POST https://piston.codeabac.us/execute HTTP/1.1
Content-Type: applicvation/json

{
    "language": "python",
    "source": "for _ in range(int(input())):\n\ta = int(input())\n\tprint(a ** 2)",
    "stdin": "3\n1\n2\n4"
}

Example Response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8

{
    "ran": true,
    "language": "python3",
    "version": "3.8.2",
    "stdout": "1\n4\n16",
    "stderr": "",
    "runtime": 137.04750394821167,
    "output": "1\n4\n16"
}