A package to give a document sync experience(and eficciency) like "repo sync", or "awscli s3 sync", and so forth.
Project description
syncs3
To give a document sync experience(and eficciency) like 'repo sync', or 'awscli s3 sync', and so forth. Permit records to be transferred on downloaded ONLY on the off chance that there is a distinction in the document's local cs remote duplicate. Give this as a convinience bundle for involving distant resources in journals.
Acknowledgements
Tech Stack
Language: Python 3.8.2
Developing syncs3
To install syncs3, along with the tools ypu need to develop and run tests, run the following in ypur virtualenv:
$ pip install -e .[dev]
Usage/Examples
Example 1: Upload object on aws
'''Create object of the LocalObjectCache to initialize the bucket name and prefix.'''
bucket_name = bucket_name
prefix = prefix_name
obj = syncs3(bucket_name, prefix)
'''uploading a obj.'''
__filename__ = file_name
key = os.path.abspath(__filename__)
obj.upload_obj(key)
Example 2: Download object from aws
'''Downloading a key from obj.'''
__filename__ = file_name
key = os.path.join(obj.prefix, __filename__)
''' download_obj takes a parameter tag which is the value of tag which is returned when the object is uploaded on the aws.'''
obj.download_obj(key, tag_value)
Example 3: sync data of remote s3 bucket and local
"""Syncs the data of remote s3 bucket and local directory."""
obj.sync()
Example 4: Delete all files form local cache
"""Delete all files from the local cache."""
obj.close()
Example 5: Pickle and un-pickle the self object between multiprocessing pools
"""It takes an argument bucket_name. If bucket name is given then it will change the bucket name else returns the current bucket name and set it at none."""
obj.set_bucket()
Example 6: Calculate s3 e-tag of a file
filename__ = file_name
key = os.path.abspath(filename__)
'''open file on `rb` mode '''
file = open(key, 'rb')
'''returns a tag of the file '''
obj.calculate_s3_etag(file)
Example 7: Get local file storage path of a given file key
filename__ = file_name
key = os.path.abspath(filename__)
'''Returns a local file storage path for a given file key '''
obj.get_path(key)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file syncs3-0.1.1.tar.gz
.
File metadata
- Download URL: syncs3-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 132582399fdffb85096cdf0b8a1255699ba3a51fbf71bc1305e1f0a8262cd32b |
|
MD5 | 8503649005a0132a8f0080070a301ee0 |
|
BLAKE2b-256 | 9895d8b225d14299fd32c5933bd70795b0d97644674f3695542fcc1e1475e65a |
File details
Details for the file syncs3-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: syncs3-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7499a549addecb2a2badef5e6023343eb18ca9069b8069002ba50541d7f95e01 |
|
MD5 | 563ee1597c35b99e7a323cab3cab87a5 |
|
BLAKE2b-256 | c6d0c5ef300e355391ea01e5a61dd26315cbec6c33cc8708ce0093dd5dc6a72b |