boto3_interface#
- ioapps.boto3_interface.filelist(bucket, object_path=None, profile_name=None, resource='s3')[source]#
DESCRIPTION:
This function returns a list containing the contents of a resource bucket path.
- Parameters:
- bucket:
str A Python string specifying the name of the resource bucket.
- bucket:
- Keywords:
- object_path:
str, optional A Python string specifying the object directory beneath the respective bucket; if present, the boto3 interface will seek only the contents with the specified object path within the specified bucket; if not present (e.g., NoneType), the entire contents of the bucket will be returned.
- profile_name:
str, optional A Python string specifying the profile name beneath the user ~/.aws/credentials file to be used to initiate the boto3 session; if NoneType upon entry an unsigned session is implied.
- resource:
str, optional A Python string specifying the supported AWS resource; allowable storage resources can be found at https://tinyurl.com/AWS-Storage-Resources.
- object_path:
- Returns:
- filelist:
List A Python list containing the contents of the resource bucket.
- filelist:
- Return type:
List
- ioapps.boto3_interface.get(bucket, filedict=None, into_mem=False, object_path=None, profile_name=None, resource='s3')[source]#
DESCRIPTION:
This function downloads objects from a user specified resource bucket either onto the respective platforms local disk (into_mem = False) or into memory (into_mem = True).
- Parameters:
- bucket:
str A Python string specifying the name of the resource bucket.
- bucket:
- Keywords:
- filedict:
Dict, optional A Python dictionary containing key and value pairs for the objects to be read from the resource bucket objects; the dictionary keys are the local file path and the respective dictionary key values are the resource object names.
- into_mem:
bool, optional A Python boolean valued variable specifying whether to read the contents of the resource bucket and object path (see object_path, below) into memory.
- object_path:
str, optional A Python string specifying the respective resource bucket object path; required and used only if into_mem is True upon entry.
- profile_name:
str, optional A Python string specifying the profile name beneath the user ~/.aws/credentials file to be used to initiate the boto3 session; if NoneType upon entry an unsigned session is implied.
- resource:
str, optional A Python string specifying the supported AWS resource; allowable storage resources can be found at https://tinyurl.com/AWS-Storage-Resources.
- filedict:
- Returns:
- object_memory:
NamedTemporaryFile A Python tempfile NamedTemporaryFile object containing the contents of the resource bucket and object path specified upon entry; if the into_mem parameter is False upon entry, the returned value is NoneType.
- object_memory:
- Raises:
- Boto3InterfaceError:
raised if parameter values provided upon entry are invalid.
raised if the downloading of a specified object path into local memory encounters and exception.
raised if the downloading of a specified object path encounters and exception.
- Return type:
NamedTemporaryFile
- ioapps.boto3_interface.put(bucket, filedict, profile_name=None, resource='s3')[source]#
DESCRIPTION:
This function uploads objects to a user specified resource bucket.
- Parameters:
- bucket:
str A Python string specifying the name of the resource bucket.
- filedict:
Dict A Python dictionary containing key and value pairs for the objects to be written to the resource bucket objects; the dictionary keys are the local file path and the respective dictionary key values are the object names.
- bucket:
- Keywords:
- profile_name:
str, optional A Python string specifying the profile name beneath the user ~/.aws/credentials file to be used to initiate the boto3 session; if NoneType upon entry an unsigned session is implied.
- resource:
str, optional A Python string specifying the supported AWS resource; allowable storage resources can be found at https://tinyurl.com/AWS-Storage-Resources.
- profile_name:
- Raises:
- Boto3InterfaceError:
raised if the uploading of a specified object path encounters and exception.
- Return type:
None