Skip to main content

python client for osparc web API v0.4.0

Project description

Python client for osparc-simcore API

test PyPI

Python client for osparc-simcore public web API

  • API version: 0.4.0
  • Package version: 0.5.0
  • 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 Classes

All URIs are relative to https://api.osparc.io

Documentation For Models

Documentation For Authorization

HTTPBasic

  • Type: HTTP basic authentication

Author

Made with love at Zurich43

Project details


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.5.0.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

osparc-0.5.0-py3-none-any.whl (53.3 kB view details)

Uploaded Python 3

File details

Details for the file osparc-0.5.0.tar.gz.

File metadata

  • Download URL: osparc-0.5.0.tar.gz
  • Upload date:
  • Size: 34.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for osparc-0.5.0.tar.gz
Algorithm Hash digest
SHA256 8094c0f7374de65818bdb2853ecdca57bac4d14b35aeeb6dbdbedfd6ecd87c4c
MD5 00b01a922e4690340f46338f44831aad
BLAKE2b-256 f7b424651e4f3fb5df657c8098e2f00de93151951bbfc79662c9fb0870ba7bc7

See more details on using hashes here.

File details

Details for the file osparc-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: osparc-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 53.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for osparc-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 14706bb8508ea88a028dbc1a3c78b55d6ced7324aed2cafb1248d6b21ad619cd
MD5 50406a351e2c6835bad60f5a67b6a91d
BLAKE2b-256 51c3a839af883b06e4f0ab103eb81e6673bcbf281a8a0d5623f7ca3ca139a8d7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page