python client for osparc web API v0.4
Project description
Python client for osparc-simcore API
Python client for osparc-simcore public web API
- API version: 0.3.0
- Package version: 0.4.3
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
Requirements
Python 3.6+
Installation & Usage
Install the latest release with
pip install osparc
or directly from the repository
pip install git+https://github.com/ITISFoundation/osparc-simcore-python-client.git
Then import the package:
import osparc
Getting Started
Please follow the installation procedure above and then run the following:
import os
import time
import osparc
from osparc.models import File, Solver, Job, JobStatus, JobInputs, JobOutputs
from osparc.api import FilesApi, SolversApi
cfg = osparc.Configuration(
host=os.environ.get("OSPARC_API_URL", "http://127.0.0.1:8006"),
username=os.environ.get("MY_API_KEY"),
password=os.environ.get("MY_API_SECRET"),
)
with osparc.ApiClient(cfg) as api_client:
files_api = FilesApi(api_client)
input_file: File = files_api.upload_file(file="path/to/input-file.h5")
solvers_api = SolversApi(api_client)
solver: Solver = solvers_api.get_solver_release("simcore/services/comp/isolve", "1.2.3")
job: Job = solvers_api.create_job(
solver.id,
solver.version,
JobInputs({"input_1": input_file, "input_2": 33, "input_3": False}),
)
status: JobStatus = solvers_api.start_job(solver.id, solver.version, job.id)
while not status.stopped_at:
time.sleep(3)
status = solvers_api.inspect_job(solver.id, solver.version, job.id)
print("Solver progress", f"{status.progress}/100", flush=True)
outputs: JobOutputs = solvers_api.get_job_outputs(solver.id, solver.version, job.id)
print( f"Job {outputs.job_id} got these results:")
for output_name, result in outputs.results.items():
print(output_name, "=", result)
Documentation for API Endpoints
All URIs are relative to http://localhost
Class | Method | HTTP request | Description |
---|---|---|---|
FilesApi | download_file | GET /v0/files/{file_id}/content | Download File |
FilesApi | get_file | GET /v0/files/{file_id} | Get File |
FilesApi | list_files | GET /v0/files | List Files |
FilesApi | upload_file | PUT /v0/files/content | Upload File |
MetaApi | get_service_metadata | GET /v0/meta | Get Service Metadata |
SolversApi | create_job | POST /v0/solvers/{solver_key}/releases/{version}/jobs | Create Job |
SolversApi | get_job | GET /v0/solvers/{solver_key}/releases/{version}/jobs/{job_id} | Get Job |
SolversApi | get_job_outputs | GET /v0/solvers/{solver_key}/releases/{version}/jobs/{job_id}/outputs | Get Job Outputs |
SolversApi | get_solver | GET /v0/solvers/{solver_key}/latest | Get Latest Release of a Solver |
SolversApi | get_solver_release | GET /v0/solvers/{solver_key}/releases/{version} | Get Solver Release |
SolversApi | inspect_job | POST /v0/solvers/{solver_key}/releases/{version}/jobs/{job_id}:inspect | Inspect Job |
SolversApi | list_jobs | GET /v0/solvers/{solver_key}/releases/{version}/jobs | List Jobs |
SolversApi | list_solver_releases | GET /v0/solvers/{solver_key}/releases | List Solver Releases |
SolversApi | list_solvers | GET /v0/solvers | List Solvers |
SolversApi | list_solvers_releases | GET /v0/solvers/releases | Lists All Releases |
SolversApi | start_job | POST /v0/solvers/{solver_key}/releases/{version}/jobs/{job_id}:start | Start Job |
SolversApi | stop_job | POST /v0/solvers/{solver_key}/releases/{version}/jobs/{job_id}:stop | Stop Job |
UsersApi | get_my_profile | GET /v0/me | Get My Profile |
UsersApi | update_my_profile | PUT /v0/me | Update My Profile |
Documentation For Models
- File
- Groups
- HTTPValidationError
- Job
- JobInputs
- JobOutputs
- JobStatus
- Meta
- Profile
- ProfileUpdate
- Solver
- TaskStates
- UserRoleEnum
- UsersGroup
- ValidationError
Documentation For Authorization
HTTPBasic
- Type: HTTP basic authentication
Author
Made with love at Zurich43
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
osparc-0.4.3.tar.gz
(31.5 kB
view details)
Built Distribution
osparc-0.4.3-py3-none-any.whl
(52.9 kB
view details)
File details
Details for the file osparc-0.4.3.tar.gz
.
File metadata
- Download URL: osparc-0.4.3.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aac36f5e439a66ca678b7e3e0e9f5b09bfb2edb28b0a707554fb4ed23cec954b |
|
MD5 | 88c651471191341ffa24726b7e5d7b0f |
|
BLAKE2b-256 | aaf537ad807afff3898474312bfbbc445728404f8ac9f0565ec5f2de820f2cf7 |
File details
Details for the file osparc-0.4.3-py3-none-any.whl
.
File metadata
- Download URL: osparc-0.4.3-py3-none-any.whl
- Upload date:
- Size: 52.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.6.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f203c6005375e8da22b8c6559403383a6d524c4a584807ac3f9079d0d1b8f306 |
|
MD5 | ed059c3fc55da81f29e47f4f4388899c |
|
BLAKE2b-256 | 29e75787316a968645d5564724f048da8b53b7dc1ad8286268ce05511f545085 |