@@ -58,7 +58,7 @@ async def store(self, files: List[File]):
58
58
tasks = [
59
59
self .ensure_existence (destination ) for destination in destinations
60
60
]
61
- logger .info ("Creating folders: %s " , destinations )
61
+ logger .info ("Creating folders: {} " , destinations )
62
62
await asyncio .gather (* tasks )
63
63
64
64
tasks = [self .upload (file ) for file in files ]
@@ -183,7 +183,7 @@ async def _request(self, method, url, headers=None, **kwargs):
183
183
async with Request (headers = _headers ) as session :
184
184
async with session .request (method , url , ** kwargs ) as response :
185
185
if not response .ok :
186
- logger .info (await response .text ())
186
+ logger .error (await response .text ())
187
187
response .raise_for_status ()
188
188
if 'application/json' in response .headers ['Content-Type' ]:
189
189
return await response .json ()
@@ -194,15 +194,15 @@ async def stream_upload(self, file: File, url: str):
194
194
async def upload_chunk (url : str , chunk : bytes ):
195
195
async with session .put (url , data = chunk ) as response :
196
196
if not response .ok :
197
- logger .info (await response .text ())
197
+ logger .error (await response .text ())
198
198
response .raise_for_status ()
199
199
200
200
# Must be a multiple of 320 KB
201
201
CHUNK_SIZE = 16 * 320 * 1024 # 5MB
202
202
headers = self .with_credentials ()
203
203
range_start = 0
204
204
total_size = await file .size ()
205
- logger .info ("Uploading file, total size: %s ..." , total_size )
205
+ logger .info ("Uploading file, total size: {} ..." , total_size )
206
206
207
207
async with Request (headers = headers ) as session :
208
208
async for chunk in read_by_chunks (file .path , CHUNK_SIZE ):
@@ -214,7 +214,7 @@ async def upload_chunk(url: str, chunk: bytes):
214
214
})
215
215
await upload_chunk (url , chunk )
216
216
range_start += content_length
217
- logger .info ("Uploaded %s " , range_start )
217
+ logger .info ("Uploaded {} " , range_start )
218
218
logger .info ("Upload completed" )
219
219
220
220
def with_credentials (self , headers : dict = None ) -> dict :
0 commit comments