genomespaceclient package¶
genomespaceclient module¶
-
class
genomespaceclient.client.
GSAceObject
(permission, sid, ace_id=None)[source]¶ Bases:
object
See: http://www.genomespace.org/support/api/restful-access-to-dm#ace
-
class
genomespaceclient.client.
GSAclObject
(object_id, object_type)[source]¶ Bases:
object
See: http://www.genomespace.org/support/api/restful-access-to-dm#acl
-
class
genomespaceclient.client.
GSDataFormat
(name, url, file_extension, description)[source]¶ Bases:
object
See: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_c
-
class
genomespaceclient.client.
GSDirectoryListing
(contents, directory)[source]¶ Bases:
object
See: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_b
-
class
genomespaceclient.client.
GSEffectiveAcl
(access_control_entries, effective_acl_object, effective_acl_id=None)[source]¶ Bases:
object
See: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_f
-
class
genomespaceclient.client.
GSFileMetadata
(name, path, url, parentUrl, size, owner, is_directory, is_link, target_path, last_modified, data_format, available_data_formats, effective_acl)[source]¶ Bases:
object
See: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_a
-
class
genomespaceclient.client.
GSSidObject
(name, sid_type, sid_id=None)[source]¶ Bases:
object
See: http://www.genomespace.org/support/api/restful-access-to-dm#sid
-
class
genomespaceclient.client.
GenomeSpaceClient
(username=None, password=None, token=None)[source]¶ Bases:
object
A simple GenomeSpace client
-
__init__
(username=None, password=None, token=None)[source]¶ Constructs a new GenomeSpace client. A username/password combination or a token must be supplied.
Parameters: - username (
str
) – GenomeSpace username - password (
str
) – GenomeSpace password - token (
str
) – A GenomeSpace auth token. If supplied, the token will be used instead of the username/password.
- username (
-
copy
(source, destination, recurse=False)[source]¶ Copies a file to/from/within GenomeSpace.
E.g. .. code-block:: python
- client.copy(“/tmp/local_file.txt”,
- “https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/hello.txt”)
Parameters: - source (
str
) – Local filename or GenomeSpace URL of source file. - destination (
str
) – Local filename or GenomeSpace URL of destination file.
-
delete
(genomespace_url, recurse=False)[source]¶ Deletes a file within a GenomeSpace folder.
E.g. .. code-block:: python
Parameters: genomespace_url ( str
) – GenomeSpace URL of file to delete.
-
get_metadata
(genomespace_url)[source]¶ Gets metadata information of a genomespace file/folder. See: http://www.genomespace.org/support/api/restful-access-to-dm#file_metadata
E.g.
client.get_metadata("https://dm.genomespace.org/datamanager/v1.0/file/Home/MyBucket/world.txt")
Parameters: genomespace_url ( str
) – GenomeSpace URL of file to delete.Return type: dict
Returns: a JSON dict in the format documented here: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_b
-
get_remaining_token_time
(genomespace_url)[source]¶ Gets the time to live for the gs-token if you have one. If you don’t have one, will return 0, as the non existent token has no time left to live. See: http://www.genomespace.org/support/api/restful-access-to-identity-server#get_token_time
E.g.
client.get_remaining_token_time('https://genomespace.genome.edu.au/')
Parameters: genomespace_url ( str
) – GenomeSpace URL.Return type: int
Returns: the time the token has left to live in milliseconds.
-
isdir
(genomespace_url)[source]¶ Returns True if a given genomespace_url is a directory
Parameters: genomespace_url ( str
) – GenomeSpace URL of file to delete.Return type: bool
Returns: True if the url is a directory. False otherwise.
-
list
(genomespace_url)[source]¶ Returns a list of files within a GenomeSpace folder.
E.g. .. code-block:: python
Parameters: genomespace_url ( str
) – GenomeSpace URL of folder to list.Return type: dict
Returns: a JSON dict in the format documented here: http://www.genomespace.org/support/api/restful-access-to-dm#appendix_b
-
mkdir
(genomespace_url, create_path=True)[source]¶ Creates a folder at a given location.
E.g. .. code-block:: python
Parameters: - genomespace_url (
str
) – GenomeSpace URL of file to delete. - create_path (
boolean
) – Create intermediate directories as required.
- genomespace_url (
-
move
(source, destination)[source]¶ Moves a file within GenomeSpace.
E.g. .. code-block:: python
Parameters: - source – GenomeSpace URL of source file. Cannot be a local file.
- destination – Local filename or GenomeSpace URL of destination file. If destination is a local file, the file will be copied to the destination and the source file deleted.
-