Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
keboola.component==1.4.4
keboola.http-client
keboola.http-client==1.0.0
mock~=5.0.1
freezegun~=1.2.2
keboola.http-client
backoff==2.2.1
dataconf==2.2.1
8 changes: 7 additions & 1 deletion src/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ def _get_folder_contents_sharepoint(self, folder_path=None, library_name=None):
if library_name:
logging.info(f"The component will try to fetch files from library {library_name}")
library_id = self._get_sharepoint_library_id(library_name)
logging.info(f"Library id: {library_id}")
library_drive_id = self._get_sharepoint_library_drive_id(library_id)
logging.info(f"Library drive id: {library_drive_id}")
if not folder_id:
folder_id = self._get_sharepoint_folder_id_from_path(library_drive_id, folder_path)
folder_path = self._make_library_folder_path(folder_id, library_drive_id)
Expand Down Expand Up @@ -235,6 +237,7 @@ def _get_sharepoint_folder_id_from_path(self, library_drive_id, folder_path):

def _get_sharepoint_library_id(self, library_name):
libraries = self._get_sharepoint_document_libraries()
logging.debug(f"Found libraries: {libraries}")
library = next((lib for lib in libraries if lib['name'] == library_name), None)
if library is None:
library = next((lib for lib in libraries if lib['webUrl'].split("/")[-1] == library_name), None)
Expand All @@ -247,7 +250,10 @@ def _get_sharepoint_library_drive_id(self, library_id):
response = self.get_request(url, is_absolute_path=True)

if response and response.status_code == 200:
return response.json()['id']
try:
return response.json()['id']
except KeyError:
raise OneDriveClientException(f"Error fetching library drive: {response.json()}")

error_message = f"Error fetching library drive: {response.status_code}, {response.text}" \
if response else "Error fetching library drive: No response received"
Expand Down