Skip to main content

SDK for using the API of Slide Score

Project description

Slide Score Python SDK

This SDK contains the client library for using API of Slide Score See the documentation for more

Examples

For more examples see the examples folder

Basic usage

Import the module and use the token and Slide Score server URL to create an instance of the API Client:

from slidescore import *
token="eyJ....<your token>...."
url="https://slidescore.example.com/"
client = APIClient(url, token)

Downloading a slide

Downloads a slide to the current directory ("."). Check the URL of the slide for image ID and study ID, or click Export cases button on study overview to get a list of slide IDs.

studyid=1
imageid=2

client.download_slide(studyid, imageid, ".")

Uploading and adding a slide to a study

localFilePath="C:/file_to_upload.tiff"
uploadFolder="UploadTest"
serverFileName="renamedSlide.tiff"

client.upload_file(localFilePath, uploadFolder, serverFileName)
client.add_slide(studyid, uploadFolder+"/"+serverFileName) 

Upload answers - study results

Results are uploaded in the same format as the download.

resultsFilePath="c:/Users/User/Downloads/Study_23_06_21_11.txt"
with open(resultsFilePath, "r") as f:
    res = f.read()
client.upload_results(studyid, res)

Set slide description

You can use (limited) set of HTML tags in slide, case, study and module descriptions:

client.update_slide_description(studyid, imageid, 'Carina Nebula: Cosmic Cliffs, Glittering Landscape of Star Birth. Image Credit: NASA, ESA, CSA, and STScI <a href="https://esawebb.org/news/weic2205/">Original</a>');

Make a request directly

The SDK doesn't include methods for all possible calls, sometimes you need to make the API request yourself:

response=clientlocal.perform_request("UpdateSlideName", {"imageId":imageid, "newName":'renamedSlide'}, method="POST")
rjson = response.json()
if 'success' not in rjson or rjson['success'] != True:
    raise SlideScoreErrorException("Failed updating slide name: " + response.text);

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

slidescore_sdk-1.5.0.tar.gz (40.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slidescore_sdk-1.5.0-py3-none-any.whl (38.7 kB view details)

Uploaded Python 3

File details

Details for the file slidescore_sdk-1.5.0.tar.gz.

File metadata

  • Download URL: slidescore_sdk-1.5.0.tar.gz
  • Upload date:
  • Size: 40.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for slidescore_sdk-1.5.0.tar.gz
Algorithm Hash digest
SHA256 0c0a5d8773ece457dae74e2eead4e0bfa87f75bfab48027e1ff4a0aa4ca123b9
MD5 58acb90700dd23bd7f12b88df39e033f
BLAKE2b-256 0e5560e0cb7f1568757a645471ddbc541e00a0ad3d73d51190cc4282297d9251

See more details on using hashes here.

File details

Details for the file slidescore_sdk-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: slidescore_sdk-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 38.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.13

File hashes

Hashes for slidescore_sdk-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64f7527fc3dbb2f9044bde187a3ebb5ca6072b55a660d76ea29d43da50a3c41c
MD5 9c6535549e2596d4f93feedc42495207
BLAKE2b-256 e9a3cbe90e6eea631c86d06c1ba8239f4f895ae131b415306fc38ced125b1a3a

See more details on using hashes here.

Supported by

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