What is LabKey's Python API?
How do I set credentials to access LabKey data from my local machine?
How do I install the API?
How do I use the API?
Where can I get more examples of the API's usage?

 

What is LabKey's Python API?

It is an API which allows to query, insert and update data on a LabKey Server from Python, plus programmatically update wikis and post to message boards.

 

How do I set credentials to access LabKey data from my local machine?

Please, check the FAQ Security for details about setting credentials.

 

How do I install the API?

Install the library in the host from which you need to access the remote LabKey data using the following command from the shell:
$ pip install labkey

More information in the GitHub's project labkey-api-python and in the Python Package Index PyPI labkey.

 

How do I use the API?

Example of accessing the content of the list "Iris" in schema "lists" of project "Public datasets / Iris dataset", using the method "select_rows()" in the Python console:

>>> from labkey.api_wrapper import APIWrapper
>>> server_context = APIWrapper('labkey-collab.scicore.unibas.ch', 'Public datasets/Iris dataset', '', use_ssl = True)
>>> result = server_context.query.select_rows('lists','Iris')
>>> print(result['rows'][0]['SepalLength'])
5.4

More information in the GitHub's project labkey-api-python.

 

Where can I get more examples of the API's usage?

In the LabKey GitHub repositories:

Toy example: test_api_filter.py

Discussion