Example #1
0
    def test_default_config_with_mode(self):
        config = default_config(mode="prod")
        auth = auth_from_config(config)
        self.assertEqual(config["url"], default_url(mode="prod"))
        self.assertEqual(auth, None)

        client = client_from_config(config)
        self.assertEqual(client.http_client.auth_strategy, None)
        self.assertEqual(client.url, default_url(mode="prod"))
Example #2
0
    def test_default_config_with_mode(self):
        config = default_config(mode="prod")
        auth = auth_from_config(config)
        self.assertEqual(config["url"], default_url(mode="prod"))
        self.assertEqual(auth, None)

        client = client_from_config(config)
        self.assertEqual(client.http_client.auth_strategy, None)
        self.assertEqual(client.url, default_url(mode="prod"))
Example #3
0
#!/usr/bin/python
"""
Make sure you have your environment setup!
1. You need Python requests >= 2.3.0
2. You need the datacat module directory in your path.
"""

from datacat import client_from_config
from datacat.config import default_config

import pprint

client = client_from_config(default_config("exo", "prod"))

# Path example
print("\nPath Example:")

path = '/EXO/Data/Raw/cxd/run00006220-0000.cxd'

try:
    dataset = client.path(path)
    pprint.pprint(dataset.__dict__)
except Exception as e:
    print("Error processing request:" + str(e))

# Children example

print("\nChildren Example:")
path = '/EXO/Data/Raw'

try:
Example #4
0
#!/usr/bin/python

"""
Make sure you have your environment setup!
1. You need Python requests >= 2.3.0
2. You need the datacat module directory in your path.
"""

from datacat import client_from_config
from datacat.config import default_config

import pprint

client = client_from_config(default_config("exo", "prod"))

# Path example
print("\nPath Example:")

path = '/EXO/Data/Raw/cxd/run00006220-0000.cxd'

try:
    dataset = client.path(path)
    pprint.pprint(dataset.__dict__)
except Exception as e:
    print("Error processing request:" + str(e))

# Children example

print("\nChildren Example:")
path = '/EXO/Data/Raw'