xlwings-utils 25.1.3.post1__py3-none-any.whl → 25.1.3.post2__py3-none-any.whl
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.
Potentially problematic release.
This version of xlwings-utils might be problematic. Click here for more details.
- xlwings_utils/xlwings_utils.py +24 -5
- {xlwings_utils-25.1.3.post1.dist-info → xlwings_utils-25.1.3.post2.dist-info}/METADATA +1 -1
- xlwings_utils-25.1.3.post2.dist-info/RECORD +6 -0
- xlwings_utils-25.1.3.post1.dist-info/RECORD +0 -6
- {xlwings_utils-25.1.3.post1.dist-info → xlwings_utils-25.1.3.post2.dist-info}/WHEEL +0 -0
- {xlwings_utils-25.1.3.post1.dist-info → xlwings_utils-25.1.3.post2.dist-info}/top_level.txt +0 -0
xlwings_utils/xlwings_utils.py
CHANGED
|
@@ -136,12 +136,18 @@ def list_dropbox(path="", recursive=False, show_files=True, show_folders=False):
|
|
|
136
136
|
headers = {"Authorization": f"Bearer {_token}", "Content-Type": "application/json"}
|
|
137
137
|
payload = {"path": str(path), "recursive": recursive, "include_deleted": False}
|
|
138
138
|
response = requests.post("https://api.dropboxapi.com/2/files/list_folder", headers=headers, json=payload, timeout=30)
|
|
139
|
-
|
|
139
|
+
try:
|
|
140
|
+
response.raise_for_status()
|
|
141
|
+
except requests.exceptions.HTTPError as e:
|
|
142
|
+
raise OSError(f"error listing dropbox. Original message is {e}") from None
|
|
140
143
|
data = response.json()
|
|
141
144
|
entries = data["entries"]
|
|
142
145
|
while data.get("has_more"):
|
|
143
146
|
response = requests.post(f"{API_RPC}/files/list_folder/continue", headers=headers, json={"cursor": data["cursor"]}, timeout=30)
|
|
144
|
-
|
|
147
|
+
try:
|
|
148
|
+
response.raise_for_status()
|
|
149
|
+
except requests.exceptions.HTTPError as e:
|
|
150
|
+
raise OSError(f"error listing dropbox. Original message is {e}") from None
|
|
145
151
|
data = response.json()
|
|
146
152
|
entries.extend(data["entries"])
|
|
147
153
|
|
|
@@ -167,6 +173,10 @@ def read_dropbox(dropbox_path):
|
|
|
167
173
|
-------
|
|
168
174
|
contents of the dropbox file : bytes
|
|
169
175
|
|
|
176
|
+
Note
|
|
177
|
+
----
|
|
178
|
+
If the file could not be read, an OSError will be raised.
|
|
179
|
+
|
|
170
180
|
Note
|
|
171
181
|
----
|
|
172
182
|
If REFRESH_TOKEN, APP_KEY and APP_SECRET environment variables are specified,
|
|
@@ -179,7 +189,7 @@ def read_dropbox(dropbox_path):
|
|
|
179
189
|
try:
|
|
180
190
|
response.raise_for_status()
|
|
181
191
|
except requests.exceptions.HTTPError as e:
|
|
182
|
-
raise
|
|
192
|
+
raise OSError(f"file {str(dropbox_path)} not found. Original message is {e}") from None
|
|
183
193
|
chunks = []
|
|
184
194
|
for chunk in response.iter_content(chunk_size=1024):
|
|
185
195
|
if chunk:
|
|
@@ -199,6 +209,10 @@ def write_dropbox(dropbox_path, contents):
|
|
|
199
209
|
contents : bytes
|
|
200
210
|
contents to be written
|
|
201
211
|
|
|
212
|
+
Note
|
|
213
|
+
----
|
|
214
|
+
If the file could not be written, an OSError will be raised.
|
|
215
|
+
|
|
202
216
|
Note
|
|
203
217
|
----
|
|
204
218
|
If REFRESH_TOKEN, APP_KEY and APP_SECRET environment variables are specified,
|
|
@@ -216,7 +230,7 @@ def write_dropbox(dropbox_path, contents):
|
|
|
216
230
|
try:
|
|
217
231
|
response.raise_for_status()
|
|
218
232
|
except requests.exceptions.HTTPError as e:
|
|
219
|
-
raise
|
|
233
|
+
raise OSError(f"file {str(dropbox_path)} could not be written. Original message is {e}") from None
|
|
220
234
|
return response
|
|
221
235
|
|
|
222
236
|
|
|
@@ -229,6 +243,10 @@ def delete_from_dropbox(dropbox_path):
|
|
|
229
243
|
dropbox_path : str or Pathlib.Path
|
|
230
244
|
path to delete
|
|
231
245
|
|
|
246
|
+
Note
|
|
247
|
+
----
|
|
248
|
+
If the file could not be deleted, an OSError will be raised.
|
|
249
|
+
|
|
232
250
|
Note
|
|
233
251
|
----
|
|
234
252
|
If REFRESH_TOKEN, APP_KEY and APP_SECRET environment variables are specified,
|
|
@@ -244,7 +262,8 @@ def delete_from_dropbox(dropbox_path):
|
|
|
244
262
|
try:
|
|
245
263
|
response.raise_for_status()
|
|
246
264
|
except requests.exceptions.HTTPError as e:
|
|
247
|
-
raise
|
|
265
|
+
raise OSError(f"file {str(dropbox_path)} could not be deleted. Original message is {e}") from None
|
|
266
|
+
return response
|
|
248
267
|
|
|
249
268
|
|
|
250
269
|
def list_local(path, recursive=False, show_files=True, show_folders=False):
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
|
|
2
|
+
xlwings_utils/xlwings_utils.py,sha256=ffhFS-g8v2qo3n-oQGqV2cMWJh_4a-wUCmMpXfbGAG0,32093
|
|
3
|
+
xlwings_utils-25.1.3.post2.dist-info/METADATA,sha256=5lhMbedlRJwU-GoxIEb9NyAAIJ7rylwwaaizE3fZAgo,12706
|
|
4
|
+
xlwings_utils-25.1.3.post2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
xlwings_utils-25.1.3.post2.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
|
|
6
|
+
xlwings_utils-25.1.3.post2.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
xlwings_utils/__init__.py,sha256=FdaRztevSu5akGL7KBUBRzqwLMRTdvVUuS2Kfp2f1Uc,68
|
|
2
|
-
xlwings_utils/xlwings_utils.py,sha256=WdWRfVg5hDZza7VaROW_EMKiu-6UUrz29xQlROx4ixU,31548
|
|
3
|
-
xlwings_utils-25.1.3.post1.dist-info/METADATA,sha256=bL9MmQ_fFKRpC9E-XMOZRQ6XMARy2EPs6yS7hKDn6D8,12706
|
|
4
|
-
xlwings_utils-25.1.3.post1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
xlwings_utils-25.1.3.post1.dist-info/top_level.txt,sha256=kf5SEv0gZiRObPhUoYcc1O_iX_wwTOPeUIYvzyYeAM4,14
|
|
6
|
-
xlwings_utils-25.1.3.post1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|