Crates.io | sandkasten-client |
lib.rs | sandkasten-client |
version | 0.2.2 |
source | src |
created_at | 2023-05-07 19:00:26.553513 |
updated_at | 2024-07-30 09:49:35.661374 |
description | Sandkasten client library for running untrusted code |
homepage | |
repository | https://github.com/Defelo/sandkasten |
max_upload_size | |
id | 859337 |
size | 27,985 |
Sandkasten client library for running untrusted code
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");
}