Acquire.Client._par module¶
-
class
PAR(url=None, key=None, encrypt_key=None, expires_datetime=None, is_readable=False, is_writeable=False, is_executable=False, driver_details=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
checksum(data)[source]¶ Return the checksum of the passed data. This is used either for validating data, and is also used to create a checksum of the URL so that the user can demonstrate that they can decrypt this PAR
-
close(decrypt_key=None)[source]¶ Close this PAR - this closes and deletes the PAR. You must pass in the decryption key so that you can validate that you have permission to read (and thus close) this PAR
-
driver_details()[source]¶ Return the driver details for this PAR. This is used only on the service that created the PAR, and returns an empty dictionary if the details are not available
-
execute(decrypt_key=None)[source]¶ Return an object that can be used to control execution of this PAR
-
static
from_data(data, passphrase=None)[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
-
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)
-
to_data(passphrase=None)[source]¶ Return a json-serialisable dictionary that contains all data for this object
-
class
BucketReader(par=None, decrypt_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, decrypt_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, decrypt_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, decrypt_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’
-