2.1.2. AuthenticateUser
Implement this function:
- authenticate_user(username: str, password: str) User
Returns an instance of an
Userthat includes all necessary data the client program needs to operate on behalf of the already-created user identified byusernameandpassword. However, raises autil.DropboxErrorin the following circumstances:If no user with
usernameexists.If the provided
passwordis invalid for the givenusername.If authentication cannot complete due to malicious action, such as an integrity violation.
- Parameters:
username (str) – The username of the user
password (str) – The password of the user
- Returns:
A
Userinstance corresponding to the user identified byusername- Return type:
- Raises:
DropboxError – if an error case occurred
Warning
This function may be called multiple times with the same credentials to obtain multiple, authenticated
Userinstances for the same user. Any actions taken by any authenticated instances of the same user must be immediately visible to all otherUserinstances corresponding to that user.For example, let \(u_1\) and \(u_2\) be two instances of the same user running on different machines. Then, if \(u_1\) uploads a file \(F\), \(u_2\) should be able to download \(F\) immediately.
Note
For simplicity, your system does not need to support concurrent operations—that is, we guarantee that individual operations between clients will be performed serially, and you should implement your client with the assumption that no other code will be running at the same time.