Get started
Fill in your host name and get started exploring your catalog with the datapath
API.
[1]:
from deriva.core import ErmrestCatalog, get_credential
Fill in your desired scheme, hostname and catalog number.
[2]:
scheme = 'https'
hostname = None
catalog_number = 1
Use DERIVA-Auth to get a credential
or use None
if your catalog allows anonymous access.
[3]:
credential = None
#credential = get_credential(hostname)
Now, connect to your catalog and the pathbuilder
interface for the catalog.
[4]:
assert scheme == 'http' or scheme == 'https', "Invalid http scheme used."
assert isinstance(hostname, str), "Hostname not set."
assert isinstance(catalog_number, int), "Invalid catalog number"
catalog = ErmrestCatalog(scheme, hostname, catalog_number, credential)
pb = catalog.getPathBuilder()
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
Cell In[4], line 2
1 assert scheme == 'http' or scheme == 'https', "Invalid http scheme used."
----> 2 assert isinstance(hostname, str), "Hostname not set."
3 assert isinstance(catalog_number, int), "Invalid catalog number"
4 catalog = ErmrestCatalog(scheme, hostname, catalog_number, credential)
AssertionError: Hostname not set.
Start using the pathbuilder, like this to get a list of your catalog’s schema names.
[5]:
list(pb.schemas)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[5], line 1
----> 1 list(pb.schemas)
NameError: name 'pb' is not defined