file¶
boto.file.bucket¶
-
class
boto.file.bucket.
Bucket
(name, contained_key)¶ Instantiate an anonymous file-based Bucket around a single key.
-
delete_key
(key_name, headers=None, version_id=None, mfa_token=None)¶ Deletes a key from the bucket.
Parameters:
-
get_all_keys
(headers=None, **params)¶ This method returns the single key around which this anonymous Bucket was instantiated.
Return type: SimpleResultSet Returns: The result from file system listing the keys requested
-
get_key
(key_name, headers=None, version_id=None, key_type=0)¶ Check to see if a particular key exists within the bucket. Returns: An instance of a Key object or None
Parameters: Return type: Returns: A Key object from this bucket.
-
new_key
(key_name=None, key_type=0)¶ Creates a new key
Parameters: key_name (string) – The name of the key to create Return type: boto.file.key.Key
Returns: An instance of the newly created key object
-
boto.file.simpleresultset¶
-
class
boto.file.simpleresultset.
SimpleResultSet
(input_list)¶ ResultSet facade built from a simple list, rather than via XML parsing.
boto.file.connection¶
boto.file.key¶
-
class
boto.file.key.
Key
(bucket, name, fp=None, key_type=0)¶ -
KEY_REGULAR_FILE
= 0¶
-
KEY_STREAM
= 3¶
-
KEY_STREAM_READABLE
= 1¶
-
KEY_STREAM_WRITABLE
= 2¶
-
close
()¶ Closes fp associated with underlying file. Caller should call this method when done with this class, to avoid using up OS resources (e.g., when iterating over a large number of files).
-
get_contents_as_string
(headers=None, cb=None, num_cb=10, torrent=False)¶ Retrieve file data from the Key, and return contents as a string.
Parameters: Return type: Returns: The contents of the file as a string
-
get_file
(fp, headers=None, cb=None, num_cb=10, torrent=False)¶ Retrieves a file from a Key
Parameters: Param: ignored in this subclass.
-
is_stream
()¶
-
set_contents_from_file
(fp, headers=None, replace=True, cb=None, num_cb=10, policy=None, md5=None)¶ Store an object in a file using the name of the Key object as the key in file URI and the contents of the file pointed to by ‘fp’ as the contents.
Parameters: - fp (file) – the file whose contents to upload
- headers (dict) – ignored in this subclass.
- replace (bool) – If this parameter is False, the method will first check to see if an object exists in the bucket with the same key. If it does, it won’t overwrite it. The default value is True which will overwrite the object.
- cb (int) – ignored in this subclass.
- num_cb – ignored in this subclass.
- policy (
boto.s3.acl.CannedACLStrings
) – ignored in this subclass. - md5 (A tuple containing the hexdigest version of the MD5 checksum of the file as the first element and the Base64-encoded version of the plain checksum as the second element. This is the same format returned by the compute_md5 method.) – ignored in this subclass.
-