# Slide Score Python SDK
This SDK contains the client library for using API of [Slide Score](https://www.SlideScore.com)
See the [documentation](https://www.slidescore.com/docs/api/index.html) 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);
Raw data
{
"_id": null,
"home_page": "https://github.com/SlideScore/SlideScore-python-sdk",
"name": "slidescore-sdk",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "slidescore, slide score, sdk, api",
"author": "Slide Score B.V.",
"author_email": "info@slidescore.com",
"download_url": "https://files.pythonhosted.org/packages/fb/d1/aa1a19c25c1b7fe0c6c6bd749663b03f44febfac110830631492d507f5cc/slidescore_sdk-1.4.8.tar.gz",
"platform": null,
"description": "# Slide Score Python SDK\r\n\r\nThis SDK contains the client library for using API of [Slide Score](https://www.SlideScore.com)\t\r\nSee the [documentation](https://www.slidescore.com/docs/api/index.html) for more \r\n\r\n# Examples\r\n\r\nFor more examples see the examples folder\r\n\r\n## Basic usage\r\n\r\nImport the module and use the token and Slide Score server URL to create an instance of the API Client:\r\n\r\n from slidescore import *\r\n token=\"eyJ....<your token>....\"\r\n url=\"https://slidescore.example.com/\"\r\n client = APIClient(url, token)\r\n\r\n## Downloading a slide \r\n\r\nDownloads 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.\r\n\r\n studyid=1\r\n imageid=2\r\n\r\n client.download_slide(studyid, imageid, \".\")\r\n\r\n\r\n## Uploading and adding a slide to a study\r\n\r\n localFilePath=\"C:/file_to_upload.tiff\"\r\n uploadFolder=\"UploadTest\"\r\n serverFileName=\"renamedSlide.tiff\"\r\n\r\n client.upload_file(localFilePath, uploadFolder, serverFileName)\r\n client.add_slide(studyid, uploadFolder+\"/\"+serverFileName) \r\n \r\n## Upload answers - study results\r\n\r\nResults are uploaded in the same format as the download.\r\n\r\n resultsFilePath=\"c:/Users/User/Downloads/Study_23_06_21_11.txt\"\r\n with open(resultsFilePath, \"r\") as f:\r\n res = f.read()\r\n client.upload_results(studyid, res)\r\n\r\n\r\n## Set slide description\r\n\r\nYou can use (limited) set of HTML tags in slide, case, study and module descriptions:\r\n\r\n 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>');\r\n\r\n\r\n## Make a request directly\r\n\r\nThe SDK doesn't include methods for all possible calls, sometimes you need to make the API request yourself:\r\n\r\n response=clientlocal.perform_request(\"UpdateSlideName\", {\"imageId\":imageid, \"newName\":'renamedSlide'}, method=\"POST\")\r\n rjson = response.json()\r\n if 'success' not in rjson or rjson['success'] != True:\r\n raise SlideScoreErrorException(\"Failed updating slide name: \" + response.text);\r\n\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "SDK for using the API of Slide Score",
"version": "1.4.8",
"project_urls": {
"Homepage": "https://github.com/SlideScore/SlideScore-python-sdk"
},
"split_keywords": [
"slidescore",
" slide score",
" sdk",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "321de9e9c9f3311a483eb3f0b1d14b1acbd46e38a7cdc047a671877fc100f2b5",
"md5": "41529c6b014a43feacfebb68944e7b64",
"sha256": "33ba1ab6b5491a5943412e55ae9a292bbc7c0117b11bd5f3743c46a76f479391"
},
"downloads": -1,
"filename": "slidescore_sdk-1.4.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "41529c6b014a43feacfebb68944e7b64",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 29753,
"upload_time": "2025-07-14T20:41:08",
"upload_time_iso_8601": "2025-07-14T20:41:08.521651Z",
"url": "https://files.pythonhosted.org/packages/32/1d/e9e9c9f3311a483eb3f0b1d14b1acbd46e38a7cdc047a671877fc100f2b5/slidescore_sdk-1.4.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fbd1aa1a19c25c1b7fe0c6c6bd749663b03f44febfac110830631492d507f5cc",
"md5": "75ce2236fec66dfc4e5869ecede86ce4",
"sha256": "d73aeaaa9784906bb707aac0117ad4a4875efa22c9b25245c568bbf462635cae"
},
"downloads": -1,
"filename": "slidescore_sdk-1.4.8.tar.gz",
"has_sig": false,
"md5_digest": "75ce2236fec66dfc4e5869ecede86ce4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 32564,
"upload_time": "2025-07-14T20:41:09",
"upload_time_iso_8601": "2025-07-14T20:41:09.824809Z",
"url": "https://files.pythonhosted.org/packages/fb/d1/aa1a19c25c1b7fe0c6c6bd749663b03f44febfac110830631492d507f5cc/slidescore_sdk-1.4.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 20:41:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "SlideScore",
"github_project": "SlideScore-python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "slidescore-sdk"
}