-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OneDrive API : fix for shared path addressing (#801)
- Loading branch information
Showing
15 changed files
with
143 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
""" | ||
Get workbook | ||
""" | ||
from office365.graph_client import GraphClient | ||
from tests import test_team_site_url | ||
from tests.graph_case import acquire_token_by_username_password | ||
|
||
file_abs_url = "{0}/Shared Documents/Financial Sample.xlsx".format(test_team_site_url) | ||
|
||
client = GraphClient(acquire_token_by_username_password) | ||
drive_item = client.shares.by_url(file_abs_url).drive_item.get().execute_query() | ||
worksheets = drive_item.workbook.worksheets.get().execute_query() | ||
for ws in worksheets: | ||
print(ws) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
import base64 | ||
|
||
from office365.runtime.paths.resource_path import ResourcePath | ||
from office365.runtime.paths.v4.entity import EntityPath | ||
|
||
|
||
def _url_to_shared_token(url): | ||
""" | ||
Converts url into shared token | ||
:param str url: | ||
""" | ||
# type: (str) -> str | ||
"""Converts url into shared token""" | ||
value = base64.b64encode(url.encode("ascii")).decode("ascii") | ||
if value.endswith("="): | ||
value = value[:-1] | ||
return "u!" + value.replace("/", "_").replace("+", "-") | ||
|
||
|
||
class SharedPath(ResourcePath): | ||
class SharedPath(EntityPath): | ||
"""Shared token path""" | ||
|
||
def patch(self, key): | ||
self._key = "items" | ||
self._parent = ResourcePath(key, ResourcePath("drives")) | ||
self.__class__ = ResourcePath | ||
return self | ||
|
||
@property | ||
def segment(self): | ||
return _url_to_shared_token(self._key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters