storeClient module

storeClient.cp(token, fr, to, verbose=False)[source]

Copy a file/directory within the store manager service

storeClient.create(token, name, type)[source]

Create a node in the store manager service

storeClient.expandFileList(token, pattern, format, full=False)[source]

Expand a filename pattern in a VOSpace URI to a list of files. We do this by getting a listing of the parent container contents from the service and then match the pattern on the client side.

storeClient.get(token, fr, to, verbose=True)[source]

Retrieve a file from the store manager service

storeClient.getFromURL(path, token)[source]
storeClient.get_profile(profile)[source]

Get the profile

Returns:profile – The name of the current profile used with the storage manager service
Return type:str

Example

# get the profile
storeClient.get_profile()
storeClient.hasmeta(s)[source]

Determine whether a string contains filename meta-characters.

storeClient.isAlive(svc_url='https://dlsvcs.datalab.noao.edu/storage')[source]

Check whether the StorageManager service at the given URL is alive and responding. This is a simple call to the root service URL or ping() method.

storeClient.list_profiles(token, profile=None, format='text')[source]

Retrieve the profiles supported by the storage manager service

Parameters:
  • token (str) – Authentication token (see function dl.auth.login())
  • profile (str) – A specific profile to list
Returns:

profiles – A list of the names of the supported profiles or a dictionary of the specific profile

Return type:

list/dict

Example

# get the list of profiles
profiles = storeClient.list_profiles(token)
storeClient.ln(token, fr, target)[source]

Create a link to a file/directory in the store manager service

storeClient.load(token, name, endpoint)[source]

Load a file from a remote endpoint to the store manager service

storeClient.ls(token, name, format='csv')[source]
Get a file/directory listing from the store manager service
Parameters:
  • token (str) – Secure token obtained via dl.auth.login()
  • name (str) –

    Valid name of file or directory, e.g. vos://somedir

    Todo

    [20161110] currently doesn’t seem to work.

  • format (str) – Default str.

Example

listing = dl.storeClient.ls(token,name='vos://somedir')
print listing

This prints for instance:

bar2.fits,foo1.csv,fancyfile.dat
storeClient.mkdir(token, name)[source]

Create a directory in the storage manager service

storeClient.mv(token, fr, to, verbose=False)[source]

Move/rename a file/directory within the store manager service

storeClient.put(token, fr, to, verbose=True)[source]

Upload a file to the store manager service

storeClient.rm(token, name, verbose=False)[source]

Delete a file from the store manager service

storeClient.rmdir(token, name)[source]

Delete a directory from the store manager service

storeClient.saveAs(token, data, name)[source]

Save the string representation of a data object as a file.

storeClient.set_profile(profile)[source]

Set the profile

Parameters:profile (str) – The name of the profile to use. The list of available ones can be retrieved from the service (see function storeClient.list_profiles())

Example

# set the profile
storeClient.set_profile("default")
storeClient.set_svc_url(svc_url)[source]

Set the storage manager service URL.

Parameters:svc_url (str) – The service URL of the storage manager to use

Example

# set the service url

url = "http://dldemo.sdm.noao.edu:7003"
storeClient.set_scv_url(url)
storeClient.sizeof_fmt(num)[source]
exception storeClient.storeClientError(message)[source]

Bases: exceptions.Exception

storeClient.tag(token, name, tag)[source]

Annotate a file/directory in the store manager service