@@ -143,16 +143,17 @@ def refresh_token(self):
143143 return self ._refresh_token
144144
145145 def get_request (self , url : str , is_absolute_path : bool , stream : bool = False ):
146+ url_path = urlparse (url ).path
146147 for attempt in range (2 ):
147148 response = self .get_raw (url , is_absolute_path = is_absolute_path , stream = stream )
148149 if response .status_code == 200 :
149150 return response
150151 elif response .status_code == 404 :
151- logging .error (f"Url { url } returned 404." )
152+ logging .error (f"URL { url_path } returned 404." )
152153 return None
153154 elif response .status_code == 401 :
154155 if attempt == 0 :
155- logging .warning (f"Got 401 fetching { url } , refreshing token and retrying..." )
156+ logging .warning (f"Got 401 fetching { url_path } , refreshing token and retrying..." )
156157 self ._get_request_tokens ()
157158 continue
158159 error_body = response .json ()
@@ -164,11 +165,11 @@ def get_request(self, url: str, is_absolute_path: bool, stream: bool = False):
164165 )
165166 elif response .status_code in (429 , 500 , 502 , 503 , 504 ):
166167 raise OneDriveTransientException (
167- f"Transient error fetching { url } : HTTP { response .status_code } - { response .text } "
168+ f"Transient error fetching { url_path } : HTTP { response .status_code } - { response .text } "
168169 )
169170 else :
170171 raise OneDriveClientException (
171- f"Cannot fetch { url } , response: { response .text } , "
172+ f"Cannot fetch { url_path } , response: { response .text } , "
172173 f"status_code: { response .status_code } "
173174 )
174175
@@ -428,7 +429,7 @@ def get_document_libraries(self, site_url):
428429 response .raise_for_status ()
429430 except HTTPError as e :
430431 raise OneDriveClientException (
431- f"Cannot get document libraries for site_url '{ site_url } ': "
432+ f"Cannot get document libraries for site URL '{ site_url } ': "
432433 f"{ response .status_code } , { response .text } "
433434 ) from e
434435
@@ -440,6 +441,13 @@ def download_files(self, file_path, output_dir, last_modified_at=None, library_n
440441 folder_path , mask = self ._split_path_mask (file_path )
441442 logging .info (f"Downloading files matching mask { mask } from folder { folder_path } " )
442443 items = self ._get_items_based_on_client_type (folder_path , library_name )
444+ files = [i for i in items if i .get ("file" )]
445+ folders = [i for i in items if i .get ("folder" )]
446+ unknown = len (items ) - len (files ) - len (folders )
447+ breakdown = f"{ len (files )} files, { len (folders )} subfolders"
448+ if unknown :
449+ breakdown += f", { unknown } unknown"
450+ logging .info (f"Found { len (items )} items ({ breakdown } ) in '{ folder_path } '" )
443451 folder_mask = self ._create_folder_mask (mask , folder_path )
444452 self ._process_items (items , folder_mask , mask , folder_path , output_dir , last_modified_at , library_name )
445453
0 commit comments