# πŸ’» Generate Executable Code Examples To run your method outside of the CCP UI, CCP can export **ready-to-run scripts** in different languages that use the CCP REST API to execute a method programmatically. These scripts let you: - Reproduce the execution from your notebook, shell, or codebase - Automate executions and integrate CCP into pipelines - Understand how the platform works under the hood --- ## 🧭 Where Can I Export the Code? You can generate a full execution script from: ### 1. **The Method Execution Form** Before running a method, select a language and click the **export icon** ![export icon](/_static/imgs/generate_code.png) - It will call CCP’s REST API to submit the method - It includes logic to poll for completion and download the results ### 2. **The Execution Monitor Page** After a method has been executed: - Use the same **language selector** to generate the execution script - This version is pre-filled with the **exact parameters used** - You can rerun or adapt it with minimal effort --- ## πŸ§ͺ What the Script Does The generated code performs the full execution lifecycle: 1. **Authentication**: using your API token 2. **Submission**: sends a POST request to `/methods/execute` 3. **Polling**: waits for the job to finish (with backoff) 4. **Result retrieval**: downloads outputs and metadata --- ## 🧬 Supported Languages | Language | What You Get | |------------------|------------------------------------------------| | **Python 3** | Uses `requests`, JSON payloads, download files | | **R** | Uses `httr`, handles polling with loops | | **Jupyter Python** | Like Python, but includes visualization cells | | **Julia 1.9.0** | Uses `HTTP.jl`, basic example | | **Bash (curl)** | Raw shell script with `curl`, polling logic | | **Bash (wget)** | Same as above, but using `wget` | ![](/_static/imgs/generate_code_selector.png) πŸ“Ž _Note_: All scripts are **self-contained** and ready to run β€” just authebticate and go. --- ## πŸ“¦ What’s in the Script A typical script contains: - `method_id` β†’ the ID of the method to run - `input_values` β†’ as JSON or inline in the body - `polling` logic β†’ to wait for job completion - `download` logic β†’ to save output files You can copy, modify, and integrate these into your automation workflows. --- ## πŸ” Security Note The script will ask you to **input your authentication password**. --- ## 🧠 Why It Matters Exporting the execution script helps you: - Debug or rerun executions with full control - Reproduce your analysis in other environments - Integrate CCP into automated systems or pipelines - Learn how to interact with the REST API --- ## πŸ”— Related - ⏯️ [Understanding Executions](/03_execution/01_executions) - 🧩 [CCP REST API Guide](/03_execution/06_rest_api)