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
/root/.local/lib/python3.6/site-packages/jwt/utils.py:7: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography. The next release of cryptography will remove support for Python 3.6.
from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurve
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)
<ipython-input-1-35969d799e0b> in <module>
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)
5 pb = catalog.getPathBuilder()
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)
<ipython-input-1-cb9f4b559a4b> in <module>
----> 1 list(pb.schemas)
NameError: name 'pb' is not defined