16 releases

0.2.2 Jul 30, 2024
0.2.0 Jan 9, 2024
0.1.7 Oct 27, 2023
0.1.4 Jul 31, 2023

#1395 in Web programming

28 downloads per month

MIT license

28KB
458 lines

check test codecov Version dependency status

Sandkasten Client

Sandkasten client library for running untrusted code

Example

use sandkasten_client::{
    schemas::programs::{BuildRequest, BuildRunRequest, MainFile},
    SandkastenClient,
};

#[tokio::main]
async fn main() {
    let client = SandkastenClient::new("http://your-sandkasten-instance".parse().unwrap());
    let result = client
        .build_and_run(&BuildRunRequest {
            build: BuildRequest {
                environment: "python".into(),
                main_file: MainFile {
                    name: Some("test.py".into()),
                    content: "print(6 * 7, end='')".into(),
                },
                ..Default::default()
            },
            run: Default::default(),
        })
        .await
        .unwrap();
    assert_eq!(result.run.stdout, "42");
}

Dependencies

~5–21MB
~314K SLoC