pyaws-s3 1.0.1__tar.gz → 1.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyaws_s3-1.0.3/LICENSE.md +21 -0
- pyaws_s3-1.0.3/LICENSE.txt +21 -0
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/PKG-INFO +61 -6
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/README.md +60 -5
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/pyaws_s3.egg-info/PKG-INFO +61 -6
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/pyaws_s3.egg-info/SOURCES.txt +2 -0
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/pyproject.toml +1 -1
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/pyaws_s3.egg-info/dependency_links.txt +0 -0
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/pyaws_s3.egg-info/requires.txt +0 -0
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/pyaws_s3.egg-info/top_level.txt +0 -0
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/setup.cfg +0 -0
- {pyaws_s3-1.0.1 → pyaws_s3-1.0.3}/setup.py +0 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Giuseppe Zileni
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2025 Giuseppe Zileni
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pyaws_s3
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.3
|
4
4
|
Summary: A Python package for AWS S3 utilities
|
5
5
|
Author: Giuseppe Zileni
|
6
6
|
Author-email: Giuseppe Zileni <giuseppe.zileni@gmail.com>
|
@@ -52,7 +52,7 @@ Dynamic: requires-python
|
|
52
52
|
|
53
53
|
## Description
|
54
54
|
|
55
|
-
`S3Client` is a Python class that simplifies interaction with AWS S3 for uploading, managing, and deleting files. It supports uploading images, DataFrames, PDFs,
|
55
|
+
`S3Client` is a Python class that simplifies interaction with AWS S3 for uploading, downloading, managing, and deleting files. It supports uploading images, DataFrames, PDFs, generating pre-signed URLs, downloading files, listing files, and deleting individual files.
|
56
56
|
|
57
57
|
## Installation
|
58
58
|
|
@@ -62,16 +62,16 @@ Make sure you have installed:
|
|
62
62
|
pip install pyaws_s3
|
63
63
|
```
|
64
64
|
|
65
|
-
### Env
|
65
|
+
### Env Variables
|
66
66
|
|
67
|
-
Make sure to add
|
67
|
+
Make sure to add these environment variables:
|
68
68
|
|
69
69
|
```bash
|
70
70
|
AWS_ACCESS_KEY_ID=<Your Access Key Id>
|
71
|
-
AWS_SECRET_ACCESS_KEY=<Your
|
71
|
+
AWS_SECRET_ACCESS_KEY=<Your Secret Access Key>
|
72
72
|
AWS_REGION=<Your Region>
|
73
73
|
AWS_BUCKET_NAME=<Your Bucket Name>
|
74
|
-
```
|
74
|
+
```
|
75
75
|
|
76
76
|
## Usage
|
77
77
|
|
@@ -125,6 +125,52 @@ import asyncio
|
|
125
125
|
await s3.delete_all(filter="your_filter")
|
126
126
|
```
|
127
127
|
|
128
|
+
#### 5. `download(object_name, local_path=None, stream=False)`
|
129
|
+
|
130
|
+
Downloads a file from the S3 bucket.
|
131
|
+
|
132
|
+
- `object_name` (str): The name of the S3 object to download.
|
133
|
+
- `local_path` (str, optional): Local path to save the downloaded file. Required if `stream` is False.
|
134
|
+
- `stream` (bool, optional): If True, returns the file content as bytes instead of saving locally.
|
135
|
+
|
136
|
+
**Examples:**
|
137
|
+
|
138
|
+
Download and save locally:
|
139
|
+
|
140
|
+
```python
|
141
|
+
local_path = s3.download("folder/image.svg", local_path="downloads/")
|
142
|
+
```
|
143
|
+
|
144
|
+
Download as bytes (stream):
|
145
|
+
|
146
|
+
```python
|
147
|
+
file_bytes = s3.download("folder/image.svg", stream=True)
|
148
|
+
```
|
149
|
+
|
150
|
+
#### 6. `list_files(filter=None) -> list[str]`
|
151
|
+
|
152
|
+
Lists all files in the S3 bucket, optionally filtered by a substring.
|
153
|
+
|
154
|
+
- `filter` (str, optional): Only files containing this substring will be listed.
|
155
|
+
|
156
|
+
**Example:**
|
157
|
+
|
158
|
+
```python
|
159
|
+
files = s3.list_files(filter="folder/")
|
160
|
+
```
|
161
|
+
|
162
|
+
#### 7. `delete_file(object_name)`
|
163
|
+
|
164
|
+
Deletes a single file from the S3 bucket.
|
165
|
+
|
166
|
+
- `object_name` (str): The name of the S3 object to delete.
|
167
|
+
|
168
|
+
**Example:**
|
169
|
+
|
170
|
+
```python
|
171
|
+
s3.delete_file("folder/image.svg")
|
172
|
+
```
|
173
|
+
|
128
174
|
## Notes
|
129
175
|
|
130
176
|
- All upload methods return a pre-signed URL for downloading the file.
|
@@ -146,4 +192,13 @@ s3 = S3Client(bucket_name="my-bucket")
|
|
146
192
|
img_url = s3.upload_image(fig, "test.svg")
|
147
193
|
df_url = s3.upload_from_dataframe(df, "mydata")
|
148
194
|
pdf_url = s3.upload_to_pdf("Hello PDF", "hello.pdf")
|
195
|
+
|
196
|
+
# Download a file
|
197
|
+
local_path = s3.download("test.svg", local_path="downloads/test.svg")
|
198
|
+
|
199
|
+
# List files
|
200
|
+
files = s3.list_files()
|
201
|
+
|
202
|
+
# Delete a file
|
203
|
+
s3.delete_file("test.svg")
|
149
204
|
```
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
## Description
|
4
4
|
|
5
|
-
`S3Client` is a Python class that simplifies interaction with AWS S3 for uploading, managing, and deleting files. It supports uploading images, DataFrames, PDFs,
|
5
|
+
`S3Client` is a Python class that simplifies interaction with AWS S3 for uploading, downloading, managing, and deleting files. It supports uploading images, DataFrames, PDFs, generating pre-signed URLs, downloading files, listing files, and deleting individual files.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -12,16 +12,16 @@ Make sure you have installed:
|
|
12
12
|
pip install pyaws_s3
|
13
13
|
```
|
14
14
|
|
15
|
-
### Env
|
15
|
+
### Env Variables
|
16
16
|
|
17
|
-
Make sure to add
|
17
|
+
Make sure to add these environment variables:
|
18
18
|
|
19
19
|
```bash
|
20
20
|
AWS_ACCESS_KEY_ID=<Your Access Key Id>
|
21
|
-
AWS_SECRET_ACCESS_KEY=<Your
|
21
|
+
AWS_SECRET_ACCESS_KEY=<Your Secret Access Key>
|
22
22
|
AWS_REGION=<Your Region>
|
23
23
|
AWS_BUCKET_NAME=<Your Bucket Name>
|
24
|
-
```
|
24
|
+
```
|
25
25
|
|
26
26
|
## Usage
|
27
27
|
|
@@ -75,6 +75,52 @@ import asyncio
|
|
75
75
|
await s3.delete_all(filter="your_filter")
|
76
76
|
```
|
77
77
|
|
78
|
+
#### 5. `download(object_name, local_path=None, stream=False)`
|
79
|
+
|
80
|
+
Downloads a file from the S3 bucket.
|
81
|
+
|
82
|
+
- `object_name` (str): The name of the S3 object to download.
|
83
|
+
- `local_path` (str, optional): Local path to save the downloaded file. Required if `stream` is False.
|
84
|
+
- `stream` (bool, optional): If True, returns the file content as bytes instead of saving locally.
|
85
|
+
|
86
|
+
**Examples:**
|
87
|
+
|
88
|
+
Download and save locally:
|
89
|
+
|
90
|
+
```python
|
91
|
+
local_path = s3.download("folder/image.svg", local_path="downloads/")
|
92
|
+
```
|
93
|
+
|
94
|
+
Download as bytes (stream):
|
95
|
+
|
96
|
+
```python
|
97
|
+
file_bytes = s3.download("folder/image.svg", stream=True)
|
98
|
+
```
|
99
|
+
|
100
|
+
#### 6. `list_files(filter=None) -> list[str]`
|
101
|
+
|
102
|
+
Lists all files in the S3 bucket, optionally filtered by a substring.
|
103
|
+
|
104
|
+
- `filter` (str, optional): Only files containing this substring will be listed.
|
105
|
+
|
106
|
+
**Example:**
|
107
|
+
|
108
|
+
```python
|
109
|
+
files = s3.list_files(filter="folder/")
|
110
|
+
```
|
111
|
+
|
112
|
+
#### 7. `delete_file(object_name)`
|
113
|
+
|
114
|
+
Deletes a single file from the S3 bucket.
|
115
|
+
|
116
|
+
- `object_name` (str): The name of the S3 object to delete.
|
117
|
+
|
118
|
+
**Example:**
|
119
|
+
|
120
|
+
```python
|
121
|
+
s3.delete_file("folder/image.svg")
|
122
|
+
```
|
123
|
+
|
78
124
|
## Notes
|
79
125
|
|
80
126
|
- All upload methods return a pre-signed URL for downloading the file.
|
@@ -96,4 +142,13 @@ s3 = S3Client(bucket_name="my-bucket")
|
|
96
142
|
img_url = s3.upload_image(fig, "test.svg")
|
97
143
|
df_url = s3.upload_from_dataframe(df, "mydata")
|
98
144
|
pdf_url = s3.upload_to_pdf("Hello PDF", "hello.pdf")
|
145
|
+
|
146
|
+
# Download a file
|
147
|
+
local_path = s3.download("test.svg", local_path="downloads/test.svg")
|
148
|
+
|
149
|
+
# List files
|
150
|
+
files = s3.list_files()
|
151
|
+
|
152
|
+
# Delete a file
|
153
|
+
s3.delete_file("test.svg")
|
99
154
|
```
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pyaws_s3
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.3
|
4
4
|
Summary: A Python package for AWS S3 utilities
|
5
5
|
Author: Giuseppe Zileni
|
6
6
|
Author-email: Giuseppe Zileni <giuseppe.zileni@gmail.com>
|
@@ -52,7 +52,7 @@ Dynamic: requires-python
|
|
52
52
|
|
53
53
|
## Description
|
54
54
|
|
55
|
-
`S3Client` is a Python class that simplifies interaction with AWS S3 for uploading, managing, and deleting files. It supports uploading images, DataFrames, PDFs,
|
55
|
+
`S3Client` is a Python class that simplifies interaction with AWS S3 for uploading, downloading, managing, and deleting files. It supports uploading images, DataFrames, PDFs, generating pre-signed URLs, downloading files, listing files, and deleting individual files.
|
56
56
|
|
57
57
|
## Installation
|
58
58
|
|
@@ -62,16 +62,16 @@ Make sure you have installed:
|
|
62
62
|
pip install pyaws_s3
|
63
63
|
```
|
64
64
|
|
65
|
-
### Env
|
65
|
+
### Env Variables
|
66
66
|
|
67
|
-
Make sure to add
|
67
|
+
Make sure to add these environment variables:
|
68
68
|
|
69
69
|
```bash
|
70
70
|
AWS_ACCESS_KEY_ID=<Your Access Key Id>
|
71
|
-
AWS_SECRET_ACCESS_KEY=<Your
|
71
|
+
AWS_SECRET_ACCESS_KEY=<Your Secret Access Key>
|
72
72
|
AWS_REGION=<Your Region>
|
73
73
|
AWS_BUCKET_NAME=<Your Bucket Name>
|
74
|
-
```
|
74
|
+
```
|
75
75
|
|
76
76
|
## Usage
|
77
77
|
|
@@ -125,6 +125,52 @@ import asyncio
|
|
125
125
|
await s3.delete_all(filter="your_filter")
|
126
126
|
```
|
127
127
|
|
128
|
+
#### 5. `download(object_name, local_path=None, stream=False)`
|
129
|
+
|
130
|
+
Downloads a file from the S3 bucket.
|
131
|
+
|
132
|
+
- `object_name` (str): The name of the S3 object to download.
|
133
|
+
- `local_path` (str, optional): Local path to save the downloaded file. Required if `stream` is False.
|
134
|
+
- `stream` (bool, optional): If True, returns the file content as bytes instead of saving locally.
|
135
|
+
|
136
|
+
**Examples:**
|
137
|
+
|
138
|
+
Download and save locally:
|
139
|
+
|
140
|
+
```python
|
141
|
+
local_path = s3.download("folder/image.svg", local_path="downloads/")
|
142
|
+
```
|
143
|
+
|
144
|
+
Download as bytes (stream):
|
145
|
+
|
146
|
+
```python
|
147
|
+
file_bytes = s3.download("folder/image.svg", stream=True)
|
148
|
+
```
|
149
|
+
|
150
|
+
#### 6. `list_files(filter=None) -> list[str]`
|
151
|
+
|
152
|
+
Lists all files in the S3 bucket, optionally filtered by a substring.
|
153
|
+
|
154
|
+
- `filter` (str, optional): Only files containing this substring will be listed.
|
155
|
+
|
156
|
+
**Example:**
|
157
|
+
|
158
|
+
```python
|
159
|
+
files = s3.list_files(filter="folder/")
|
160
|
+
```
|
161
|
+
|
162
|
+
#### 7. `delete_file(object_name)`
|
163
|
+
|
164
|
+
Deletes a single file from the S3 bucket.
|
165
|
+
|
166
|
+
- `object_name` (str): The name of the S3 object to delete.
|
167
|
+
|
168
|
+
**Example:**
|
169
|
+
|
170
|
+
```python
|
171
|
+
s3.delete_file("folder/image.svg")
|
172
|
+
```
|
173
|
+
|
128
174
|
## Notes
|
129
175
|
|
130
176
|
- All upload methods return a pre-signed URL for downloading the file.
|
@@ -146,4 +192,13 @@ s3 = S3Client(bucket_name="my-bucket")
|
|
146
192
|
img_url = s3.upload_image(fig, "test.svg")
|
147
193
|
df_url = s3.upload_from_dataframe(df, "mydata")
|
148
194
|
pdf_url = s3.upload_to_pdf("Hello PDF", "hello.pdf")
|
195
|
+
|
196
|
+
# Download a file
|
197
|
+
local_path = s3.download("test.svg", local_path="downloads/test.svg")
|
198
|
+
|
199
|
+
# List files
|
200
|
+
files = s3.list_files()
|
201
|
+
|
202
|
+
# Delete a file
|
203
|
+
s3.delete_file("test.svg")
|
149
204
|
```
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|