Skip to main content

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 *
api_key =  "eyb..<your api token>"
slidescore_host =  'https://example.slidescore.com/'

client = APIClient(slidescore_host, api_key)

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.

study_id=1
image_id=2

client.download_slide(study_id, image_id, ".")

Uploading and adding a slide to a study

local_file_path = "/tmp/file_to_upload.tiff"
server_upload_folder = "UploadTest"
server_file_name = "renamedSlide.tiff"
study_id = 1

client.upload_file(
    local_file_path,
    server_upload_folder,
    server_file_name,
)

client.add_slide(
    study_id,
    server_upload_folder + "/" + server_file_name,
)    

Upload answers - study results

Results are uploaded in the same format as the download.

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

Set slide description

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

client.update_slide_description(study_id, image_id, '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":image_id, "newName":'renamedSlide'}, method="POST")
rjson = response.json()
if 'success' not in rjson or rjson['success'] != True:
    raise SlideScoreErrorException("Failed updating slide name: " + response.text);

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.4.tar.gz (41.6 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.4-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slidescore_sdk-1.5.4.tar.gz
  • Upload date:
  • Size: 41.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for slidescore_sdk-1.5.4.tar.gz
Algorithm Hash digest
SHA256 aad7b98335efd1b55716963f7fb4136256268110812a2acc297bfc8dc421528b
MD5 45d7db7889379ca7d743042e9e41a842
BLAKE2b-256 c7d12d93abe201faafbaba359b1562e3e13aba716902133679d58297ff97926f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: slidescore_sdk-1.5.4-py3-none-any.whl
  • Upload date:
  • Size: 39.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for slidescore_sdk-1.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c51f8ca6464924552be72a1203def0fd65fcac5b9ed6078c5e6d0f01ddb1e7bf
MD5 7e1551c0091950287d4fb9777b3b859f
BLAKE2b-256 ce641776f26e01104dbfeb433a3983b2b04bbd0f73a24d6c4daaa24ea1302345

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.5.4 This release

2 files

1.5.3

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.4.9

2 files

1.4.8

2 files

1.4.7

2 files

1.4.6

2 files

1.4.5

2 files

1.4.4

2 files

1.4.3

2 files

1.4.2

2 files

1.4.1

2 files

1.4.0

2 files

1.3.10

2 files

1.3.9

2 files

1.3.8

2 files

1.3.7

2 files

1.3.6

2 files

1.3.5

2 files

1.2.21

2 files

1.2.20

2 files

1.2.19

2 files

1.2.18

2 files

1.2.17

2 files

1.2.16

2 files

1.2.15

2 files

1.2.14

2 files

1.2.13

2 files

1.2.12

2 files

1.2.11

2 files

1.2.10

2 files

1.2.9

2 files

1.2.8

2 files

1.2.7

2 files

1.2.6

2 files

1.2.5

2 files

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.2

2 files

1.1.1

2 files

1.1.0

2 files

Supported by

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