Skip to main content

Utility modules for the s3 get s3 last modified objects tasks.

Project description

s3_last_modified_objects with bucket, path and last_modified_date

Utilities for latest files from s3 bucket

Parameters:

    Args:
            s3client:
            boto3 S3 client
            bucket:
            Name of the S3 bucket.
            prefix:
            Only fetch objects whose key starts with this prefix (optional).
            suffix:
            Only fetch objects whose keys end with this suffix (optional).
            last_modified_date: Only yield objects with LastModified dates greater or equal to this value (optional).

    Returns:
            Dictionary objects for each qualifying S3 object through a generator. The dict includes:
            key
                    the object key (name)
            size
                    the size of the object in bytes (integer)
            last_modified
                    the datetime object of which has modified based on parameter last_modified_date or by defualt 1 day before current date

Example Usage .. code-block:: python

    from s3_last_modified_objects import s3_objects
    from datetime import datetime,timedelta
    import boto3

    bucket='bucket_customer'
    path='products'
    last_modified_date =(datetime.now() - timedelta(days=1)).strftime('%Y-%m-%d')  
    s3client = boto3.client('s3')
    object_dict= s3_objects.latest_files(
            s3client=s3client,
            bucket=bucket,
            prefix=path,
            last_modified_date=last_modified_date)
    for obj in object_dict:
        print(obj)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

s3_last_modified_objects-0.0.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file s3_last_modified_objects-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for s3_last_modified_objects-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6b37d6871be6cc4f543db3e87da5b87a859a202bddb92d8ec2b7fb7e572a2d0e
MD5 932ceb036a311c937fb464d7e7425f49
BLAKE2b-256 0d8b4840dcd8a6cbf264245e8606da09014b75ed75d98086b010f3a07527b875

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page