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
-
setup token
-
setup URL of the Slide Score server
-
create an instance of the API Client
from slidescore import *
token="eyJ........" 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
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
Built Distribution
File details
Details for the file slidescore-sdk-1.4.5.tar.gz
.
File metadata
- Download URL: slidescore-sdk-1.4.5.tar.gz
- Upload date:
- Size: 25.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfdb093aeb5d4de02c6384f896209c470a121b706f9e7f1e6e35348ea96f6b92 |
|
MD5 | 69e51ee6f846ef68efd2727abfcee0e5 |
|
BLAKE2b-256 | 3ca015f4bbb8934a4b1408b1d05ee32b6d5c7340f5059a8c746114b3b7d32054 |
File details
Details for the file slidescore_sdk-1.4.5-py3-none-any.whl
.
File metadata
- Download URL: slidescore_sdk-1.4.5-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed12def8e31bd87263a50f19df41ba7ed2e8e0f585ce18610a4cf58d8a958976 |
|
MD5 | 8f5fecc72637ffba9c6f5c165830a188 |
|
BLAKE2b-256 | ce69530dc28aead7c54223ec639514d32f93c11b22696b0c9763bbab53f92cf7 |