User
 toggl_api.UserEndpoint
¶
              Bases: TogglEndpoint[Any]
Endpoint for retrieving user data.
| PARAMETER | DESCRIPTION | 
|---|---|
auth
 | 
 Authentication for the client. 
TYPE:
  | 
client
 | 
 Optional client to be passed to be used for requests. Useful when a global client is used and needs to be recycled. 
TYPE:
  | 
timeout
 | 
 How long it takes for the client to timeout. Keyword Only. Defaults to 10 seconds. 
TYPE:
  | 
re_raise
 | 
 Whether to raise all HTTPStatusError errors and not handle them internally. Keyword Only. 
TYPE:
  | 
retries
 | 
 Max retries to attempt if the server returns a 5xx status_code.
Has no effect if re_raise is  
TYPE:
  | 
| METHOD | DESCRIPTION | 
|---|---|
verify_authentication | 
 Check if user is correctly authenticated with the Toggl API.  | 
get_details | 
 Return details for the current user.  | 
Source code in src/toggl_api/_user.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115  |  | 
 verify_authentication
staticmethod
¶
verify_authentication(
    auth: BasicAuth, *, client: Client | None = None
) -> bool
Check if user is correctly authenticated with the Toggl API.
Examples:
>>> UserEndpoint.verify_authentication(auth)
True
>>> auth = generate_authentication()
>>> UserEndpoint.verify_authentication(auth)
True
| PARAMETER | DESCRIPTION | 
|---|---|
auth
 | 
 Basic authentication object either created manually or one of the provided authentication utilities. 
TYPE:
  | 
client
 | 
 Optional client for making the requests with when using a singleton/global client. 
TYPE:
  | 
| RAISES | DESCRIPTION | 
|---|---|
HTTPStatusError
 | 
 If anything that is error status code that is not a FORBIDDEN code.  | 
| RETURNS | DESCRIPTION | 
|---|---|
bool
 | 
 True if successfully verified authentication else False.  | 
Source code in src/toggl_api/_user.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96  |  | 
 get_details
¶
Return details for the current user.
| RAISES | DESCRIPTION | 
|---|---|
HTTPStatusError
 | 
 If the request is not a successful status code.  | 
| RETURNS | DESCRIPTION | 
|---|---|
dict[str, Any]
 | 
 User details in a raw dictionary.  | 
Source code in src/toggl_api/_user.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115  |  | 
 toggl_api.asyncio.AsyncUserEndpoint
¶
              Bases: TogglAsyncEndpoint[Any]
Endpoint for retrieving user data.
The synchronous sibling UserEndpoint has access to static method for verifying authentication.
| PARAMETER | DESCRIPTION | 
|---|---|
auth
 | 
 Authentication for the client. 
TYPE:
  | 
client
 | 
 Optional async client to be passed to be used for requests. 
TYPE:
  | 
timeout
 | 
 How long it takes for the client to timeout. Keyword Only. Defaults to 10 seconds. 
TYPE:
  | 
re_raise
 | 
 Whether to raise all HTTPStatusError errors and not handle them internally. Keyword Only. 
TYPE:
  | 
retries
 | 
 Max retries to attempt if the server returns a 5xx status_code.
Has no effect if re_raise is  
TYPE:
  | 
| METHOD | DESCRIPTION | 
|---|---|
get_details | 
 Return details for the current user.  |