Skip to main content

Execute Python code.

POST 

/code/python-b2

This endpoint runs Python code in a Linux sandbox using the CPython interpreter. You can return data from the code by setting the global result variable. Logging something to the console has no effect. To import dependencies, first add all dependencies to the requirements array, and then import them using the common import statement. All dependencies will be automatically downloaded and installed for you, with the exception of native system dependencies. There is a time limit of 180s and a memory limit of 512MB applied to your code, which also includes the dependency download process. One execution of this module costs 50 credits.

Request

Header Parameters

    authorization string

    The API key that can be retrieved from 0codekit.com.

    ipaas string

Bodyrequired

    codestringrequired

    The Python code that will be executed.

    Example: import requests result = { "data": requests.get("https://0codekit.com").text }
    requirementsstring[]

    The PyPI libraries your Python code requires. For backwards compatibility, this can be left empty, and your dependencies will be discovered automatically. Please do not use this and specify your requirements explicitly, as the automatic discovery is inaccurate and unreliable, and its only purpose is to prevent old code from breaking.

    Example: []
    dependenciesstring[]

    The system dependencies your Python code requires. These will be installed using apk, the Alpine Package manager.

    Example: []

Responses

Success

Schema
    resultrequired

    The data returned by the Python code.