Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/davidmchan/yas3
Yet another Python S3 client
https://github.com/davidmchan/yas3
Last synced: 7 days ago
JSON representation
Yet another Python S3 client
- Host: GitHub
- URL: https://github.com/davidmchan/yas3
- Owner: DavidMChan
- License: other
- Created: 2020-11-02T04:50:51.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2020-11-03T18:51:02.000Z (over 4 years ago)
- Last Synced: 2025-01-03T03:35:44.622Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 14.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# YAS3 - Yet Another S3 Client
Yas3 is a simple client for managing buckets/storage in S3 (and S3 compatible endpoints) for people who don't want the complexity of learning boto3.
## Uploading Objects
You can upload from Object paths:
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
conn.upload('test.txt', 'Object.txt', bucket='bucket')
```Or as bytes:
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
conn.upload(Object_bytes, 'Object.txt', bucket='bucket', type='application/octet-stream')
```The Object type is guessed using mimetypes, but it can be easily specified using ```mimetype='text/json'```.
## Downloading Objects
You can download the Object locally:
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
conn.download('Object.txt', 'test.txt', bucket='bucket')
```Or you can get the response directly:
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
bucket_data = conn.get('Object.txt', bucket='bucket')
print(bucket_data)
```## Object Operations
Moving Objects:
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
conn.move('Object.txt', 'new_Object.txt', source_bucket='bucket', target_bucket='bucket')
```Copying Objects:
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
conn.copy('Object.txt', 'new_Object.txt', source_bucket='bucket', target_bucket='bucket')
```Deleting Objects:
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
conn.delete('Object.txt', bucket='bucket')
```Listing Objects in a bucket
```python
with yas3.Connection(access_key=ACCESS_KEY, secret_key=SECRET_KEY, endpoint=ENDPOINT) as conn:
conn.list_Objects(bucket='bucket', prefix=None)
```## Using it as an object
If you want to create an object, feel free:
```python
conn = yas3.Connection(...)
...
conn.close()
```## Full Docs
See the full API documentation here.