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

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.10, <3.13

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-4.0.0.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

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

cytomine_python_client-4.0.0-py3-none-any.whl (44.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for cytomine_python_client-4.0.0.tar.gz
Algorithm Hash digest
SHA256 f50841d084d4443015757bb045783844ed8c18702660c86a468ec69eca84e651
MD5 74103ccef842e062aeb607a91499bf24
BLAKE2b-256 296b86762ea76cfdf74637aec1569ad7639e3e6d1bdbe04e883eb4391852c98f

See more details on using hashes here.

File details

Details for the file cytomine_python_client-4.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cytomine_python_client-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cda6673304357b8d0e47b6212067048ba2dfc13c581c361969543497bf41b89c
MD5 27dd41283bfc12f08c50a185ae1bca45
BLAKE2b-256 5389da4a9ef38f34cc921b401df52b574d64faf58969c53f83e7a60b4650a5f8

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