airbyte-source-microsoft-sharepoint 0.2.2__tar.gz → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-source-microsoft-sharepoint
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Source implementation for Microsoft SharePoint.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -5,7 +5,7 @@ requires = [
5
5
  build-backend = "poetry.core.masonry.api"
6
6
 
7
7
  [tool.poetry]
8
- version = "0.2.2"
8
+ version = "0.2.3"
9
9
  name = "airbyte-source-microsoft-sharepoint"
10
10
  description = "Source implementation for Microsoft SharePoint."
11
11
  authors = [
@@ -32,7 +32,7 @@ class OAuthCredentials(BaseModel):
32
32
  description="Client Secret of your Microsoft developer application",
33
33
  airbyte_secret=True,
34
34
  )
35
- refresh_token: str = Field(
35
+ refresh_token: Optional[str] = Field(
36
36
  title="Refresh Token",
37
37
  description="Refresh Token of your Microsoft developer application",
38
38
  airbyte_secret=True,
@@ -199,14 +199,18 @@ class SourceMicrosoftSharePointStreamReader(AbstractFileBasedStreamReader):
199
199
  """
200
200
  drives = execute_query_with_retry(self.one_drive_client.drives.get())
201
201
 
202
- if self.config.credentials.auth_type == "Client":
203
- my_drive = execute_query_with_retry(self.one_drive_client.me.drive.get())
204
- else:
205
- my_drive = execute_query_with_retry(
206
- self.one_drive_client.users.get_by_principal_name(self.config.credentials.user_principal_name).drive.get()
207
- )
202
+ # skip this step for application authentication flow
203
+ if self.config.credentials.auth_type != "Client" or (
204
+ hasattr(self.config.credentials, "refresh_token") and self.config.credentials.refresh_token
205
+ ):
206
+ if self.config.credentials.auth_type == "Client":
207
+ my_drive = execute_query_with_retry(self.one_drive_client.me.drive.get())
208
+ else:
209
+ my_drive = execute_query_with_retry(
210
+ self.one_drive_client.users.get_by_principal_name(self.config.credentials.user_principal_name).drive.get()
211
+ )
208
212
 
209
- drives.add_child(my_drive)
213
+ drives.add_child(my_drive)
210
214
 
211
215
  return drives
212
216
 
@@ -226,11 +230,15 @@ class SourceMicrosoftSharePointStreamReader(AbstractFileBasedStreamReader):
226
230
  # Get files from accessible drives
227
231
  yield from self._get_files_by_drive_name(self.drives, self.config.folder_path)
228
232
 
229
- if self.config.search_scope in ("SHARED_ITEMS", "ALL"):
230
- parsed_drives = [] if self.config.search_scope == "SHARED_ITEMS" else self.drives
233
+ # skip this step for application authentication flow
234
+ if self.config.credentials.auth_type != "Client" or (
235
+ hasattr(self.config.credentials, "refresh_token") and self.config.credentials.refresh_token
236
+ ):
237
+ if self.config.search_scope in ("SHARED_ITEMS", "ALL"):
238
+ parsed_drives = [] if self.config.search_scope == "SHARED_ITEMS" else self.drives
231
239
 
232
- # Get files from shared items
233
- yield from self._get_shared_files_from_all_drives(parsed_drives)
240
+ # Get files from shared items
241
+ yield from self._get_shared_files_from_all_drives(parsed_drives)
234
242
 
235
243
  def get_matching_files(self, globs: List[str], prefix: Optional[str], logger: logging.Logger) -> Iterable[RemoteFile]:
236
244
  """