aws_tools package

Submodules

aws_tools.dynamodb_handler module

class aws_tools.dynamodb_handler.DynamoDBHandler(table_name, aws_access_key_id=None, aws_secret_access_key=None, aws_region_name=u'us-west-2')[source]

Bases: object

delete_item(keys)[source]
get_item(keys)[source]
get_item_count()[source]

get number of items in table - one caveat is that this value may be off since AWS only updates it every 6 hours :return:

insert_item(data)[source]
query_items(query=None, only_fields_with_values=True, query_chunk_limit=-1)[source]

gets items from database (this actually does scan, not query. See query_raw() for true query) :param query: :param only_fields_with_values: :param query_chunk_limit: not an absolute count, but a threshold where we stop fetching more chunks

(if negative then no limit, but will read all chunks)
Returns:
query_raw(**params)[source]

gets :param params: :return:

setup_resources()[source]
update_item(keys, data)[source]

aws_tools.s3_handler module

class aws_tools.s3_handler.S3Handler(bucket_name=None, aws_access_key_id=None, aws_secret_access_key=None, aws_region_name=u'us-west-2')[source]

Bases: object

copy(from_key, from_bucket=None, to_key=None, catch_exception=True)[source]
create_bucket(bucket_name=None, catch_exception=True)[source]
delete_file(key, catch_exception=True)[source]
download_dir(key_prefix, local)[source]
download_file(key, local_file)[source]

Download file from S3 bucket. Similar to s3.download_file except that does not play nicely with moto, this however, does. :param string key: object to download :param string local_file: file to download to

get_file_contents(key, catch_exception=True)[source]
get_json(key, catch_exception=True)[source]
get_object(key)[source]
get_objects(prefix=None, suffix=None)[source]
key_exists(key, bucket_name=None)[source]
key_modified_time(key, bucket_name=None)[source]

get last modified time for key :param key: :param bucket_name: :return:

put_contents(key, body, catch_exception=True)[source]
redirect(key, location)[source]
replace(key, catch_exception=True)[source]
setup_resources()[source]
upload_file(path, key, cache_time=600, content_type=None)[source]

Upload file to S3 storage. Similar to the s3.upload_file, however, that does not work nicely with moto, whereas this function does. :param string path: file to upload :param string key: name of the object in the bucket

Module contents