Skip to main content

Python client to interact with Cytomine.

Project description

Cytomine Python client

Cytomine-python-client is an open-source Cytomine client written in Python. This client is a Python wrapper around Cytomine REST API gateway.

GitHub release GitHub

Overview

All data available from the Cytomine graphical interface can be manipulated programmatically from your computer. This page introduces the key concepts on how to interact with Cytomine without this graphical interface. Cytomine is a RESTful application. It means that the data stored and managed by Cytomine can be obtained through specific URLs. Contrary to the graphical interface, these URLs only provide relevant information data. To ease interaction with Cytomine, the Cytomine API client for Python encapsulates all the technical details relative to the HTTP API so that you can manipulate Cytomine resources without complexity.

Requirements

  • Python 3.5+

Installation

cytomine-python-client is available on PyPi using pip:

pip install cytomine-python-client

For versions lower than 2.3.4, refer to manual installation guide.

Usage

See detailed usage documentation for the complete documentation.

Basic example

Three parameters are required to connect:

  • HOST: The full URL of Cytomine core (e.g. “http://demo.cytomine.be”).
  • PUBLIC_KEY: Your cytomine public key.
  • PRIVATE_KEY: Your cytomine private key.

First, the connection object has to be initialised.

from cytomine import Cytomine

host = "demo.cytomine.be"
public_key = "XXX" # check your own keys from your account page in the web interface
private_key = "XXX"

cytomine = Cytomine.connect(host, public_key, private_key)

The next sample code should print “Hello {username}” where {username} is replaced by your Cytomine username and print the list of available projects.

from cytomine.models import ProjectCollection

print(f"Hello {cytomine.current_user}")
projects = ProjectCollection().fetch()
print(projects)
for project in projects:
    print(project)

Other examples

License

Apache-2.0

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

cytomine_python_client-3.1.0.tar.gz (37.4 kB view details)

Uploaded Source

File details

Details for the file cytomine_python_client-3.1.0.tar.gz.

File metadata

  • Download URL: cytomine_python_client-3.1.0.tar.gz
  • Upload date:
  • Size: 37.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for cytomine_python_client-3.1.0.tar.gz
Algorithm Hash digest
SHA256 a6171498f0f24cc337e76abe4c86cfcbb1c89f7e138d45038c61fac27488d86a
MD5 efbd645c5d76207aa3a2b8e4dd963db7
BLAKE2b-256 3e64913ab2390277b2d896d23fbbff6d4f2b7ac725edc2689845a73870924dad

See more details on using hashes here.

Supported by

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