Acquire.Client._par module¶
-
class
PAR(url=None, key=None, encrypt_key=None, created_datetime=None, expires_datetime=None, is_readable=False, is_writeable=False, is_executable=False, par_id=None, par_name=None, driver=None)[source]¶ Bases:
objectThis class holds the result of a pre-authenticated request (a PAR - also called a pre-signed request). This holds a pre-authenticated URL to access either;
- A individual object in an object store (read or write)
- An entire bucket in the object store (write only)
- A calculation to be performed on the compute service (start or stop)
The PAR is created encrypted, so can only be used by the person or service that has access to the decryption key
-
static
from_data(data)[source]¶ Return a PAR constructed from the passed json-deserliased dictionary
-
key()[source]¶ Return the key for the object this accesses - this is None if the PAR grants access to the entire bucket
-
par_id()[source]¶ Return the ID of the PAR, if this was supplied by the underlying driver. This could be useful for PAR management by the server
-
par_name()[source]¶ Return the user-supplied name of the PAR, if this was supplied by the user and supported by the underlying driver. This could be useful for PAR management by the server
-
seconds_remaining(buffer=30)[source]¶ Return the number of seconds remaining before this PAR expires. This will return 0 if the PAR has already expired. To be safe, you should renew PARs if the number of seconds remaining is less than 60. This will subtract ‘buffer’ seconds from the actual validity to provide a buffer against race conditions (function says this is valid when it is not)
-
class
BucketReader(par=None, encrypt_key=None)[source]¶ Bases:
objectThis class provides functions to enable reading data from a bucket via a PAR
-
get_object_as_file(key, filename)[source]¶ Get the object contained in the key ‘key’ in the passed ‘bucket’ and writing this to the file called ‘filename’
-
-
class
BucketWriter(par=None, encrypt_key=None)[source]¶ Bases:
objectThis class provides functions to enable writing data to a bucket via a PAR
-
set_object_from_file(key, filename)[source]¶ Set the value of ‘key’ in ‘bucket’ to equal the contents of the file located by ‘filename’
-
-
class
ObjectReader(par=None, encrypt_key=None)[source]¶ Bases:
objectThis class provides functions for reading an object via a PAR
-
get_object_as_file(filename)[source]¶ Get the object contained in this PAR and write this to the file called ‘filename’
-
-
class
ObjectWriter(par=None, encrypt_key=None)[source]¶ Bases:
Acquire.Client._par.ObjectReaderThis is an extension of ObjectReader that also allows writing to the object via the PAR
-
set_object_from_file(filename)[source]¶ Set the value of the object behind this PAR to equal the contents of the file located by ‘filename’
-