Make with_path_root() update existing headers rather than overwrite them #206
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
When using the Python SDK with a team-based access token and accessing a user's root namespace you would typically perform the following steps:
team_dbx = dropbox.DropboxTeam("access token")
user_dbx = team_dbx.as_user("member id")
get root namespace via get_current_account()
user_with_path_root_dbx = user_dbx.with_path_root(PathRoot.root("root ns"))
user_with_path_root_dbx.files_list_folder(path="")
...
When doing this, the Select-User header is overwritten inside with_path_root().
Headers before call to with_path_root():
{'Dropbox-API-Select-User': 'dbmid:AACJlzwHrjpPqqnHys__AnsTo9CLNUou6Ek'}
Headers after calling with_path_root():
{'Dropbox-API-Path-Root': '{".tag": "root", "root": "1337955185"}'}
Headers we want after calling with_path_root():
{'Dropbox-API-Path-Root': '{".tag": "root", "root": "1337955185"}', 'Dropbox-API-Select-User': 'dbmid:AACJlzwHrjpPqqnHys__AnsTo9CLNUou6Ek'}
with_path_root() should modify the headers rather than overwriting them.