@@ -493,22 +493,50 @@ class DropboxTeam(_DropboxTransport, DropboxTeamBase):
493493 token. Methods of this class are meant to act on the team, but there is
494494 also an :meth:`as_user` method for assuming a team member's identity.
495495 """
496+ def as_admin (self , team_member_id ):
497+ """
498+ Allows a team credential to assume the identity of an administrator on the team
499+ and perform operations on any team-owned content.
500+
501+ :param str team_member_id: team member id of administrator to perform actions with
502+ :return: A :class:`Dropbox` object that can be used to query on behalf
503+ of this admin of the team.
504+ :rtype: Dropbox
505+ """
506+ return self ._get_dropbox_client_with_select_header ('Dropbox-API-Select-Admin' ,
507+ team_member_id )
496508
497509 def as_user (self , team_member_id ):
498510 """
499511 Allows a team credential to assume the identity of a member of the
500512 team.
501513
514+ :param str team_member_id: team member id of team member to perform actions with
502515 :return: A :class:`Dropbox` object that can be used to query on behalf
503516 of this member of the team.
504517 :rtype: Dropbox
505518 """
519+ return self ._get_dropbox_client_with_select_header ('Dropbox-API-Select-User' ,
520+ team_member_id )
521+
522+ def _get_dropbox_client_with_select_header (self , select_header_name , team_member_id ):
523+ """
524+ Get Dropbox client with modified headers
525+
526+ :param str select_header_name: Header name used to select users
527+ :param str team_member_id: team member id of team member to perform actions with
528+ :return: A :class:`Dropbox` object that can be used to query on behalf
529+ of a member or admin of the team
530+ :rtype: Dropbox
531+ """
532+
506533 new_headers = self ._headers .copy () if self ._headers else {}
507- new_headers ['Dropbox-API-Select-User' ] = team_member_id
534+ new_headers [select_header_name ] = team_member_id
508535 return Dropbox (
509536 self ._oauth2_access_token ,
510537 max_retries_on_error = self ._max_retries_on_error ,
511538 max_retries_on_rate_limit = self ._max_retries_on_rate_limit ,
539+ timeout = self ._timeout ,
512540 user_agent = self ._raw_user_agent ,
513541 session = self ._session ,
514542 headers = new_headers ,
0 commit comments