Skip to content

Make with_path_root() update existing headers rather than overwrite them #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2020

Conversation

karandeep-johar
Copy link
Contributor

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.

@karandeep-johar karandeep-johar merged commit 51b8d3a into master Jul 7, 2020
@karandeep-johar karandeep-johar deleted the fix_headers_path_root_clone_issue branch July 7, 2020 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants