rbtools.api.client¶
Classes
| 
 | Main client used to talk to a Review Board server's API. | 
- class rbtools.api.client.RBClient(url: str, transport_cls: ~typing.Type[~rbtools.api.transport.Transport] = <class 'rbtools.api.transport.sync.SyncTransport'>, *args, **kwargs)[source]¶
- Bases: - object- Main client used to talk to a Review Board server’s API. - This provides methods used to authenticate with a Review Board API and perform API requests. - Clients make use of a transport class for all server communication. This handles all HTTP-related state and communication, and can be used to mock, intercept, or alter the way in which clients talk to Review Board. - Most methods wrap methods on the transport, which may change how arguments are provided and data is returned. With the default sync transport, no additional arguments are provided in any - *argsor- **kwargs, and results are returned directly from the methods.- __init__(url: str, transport_cls: ~typing.Type[~rbtools.api.transport.Transport] = <class 'rbtools.api.transport.sync.SyncTransport'>, *args, **kwargs) None[source]¶
- Initialize the client. 
 - get_root(*args, **kwargs) Optional[Resource][source]¶
- Return the root resource of the API. - Parameters:
- *args ( - tuple) – Positional arguments to pass to the transport’s- get_root().
- **kwargs ( - dict) – Keyword arguments to pass to the transport’s- get_root().
 
- Returns:
- The root API resource. 
- Return type:
- Raises:
- rbtools.api.errors.APIError – The API returned an error. Details are in the error object. 
- rbtools.api.errors.ServerInterfaceError – There was a non-API error communicating with the Review Board server. The URL may have been invalid. The reason is in the exception’s message. 
 
 
 - get_path(path: str, *args, **kwargs) Optional[Resource][source]¶
- Return the API resource at the given path. - Parameters:
- path ( - str) – The path relative to the Review Board server URL.
- *args ( - tuple) – Positional arguments to pass to the transport’s- get_path().
- **kwargs ( - dict) – Keyword arguments to pass to the transport’s- get_path().
 
- Returns:
- The resource at the given path. 
- Return type:
- Raises:
- rbtools.api.errors.APIError – The API returned an error. Details are in the error object. 
- rbtools.api.errors.ServerInterfaceError – There was a non-API error communicating with the Review Board server. The URL may have been invalid. The reason is in the exception’s message. 
 
 
 - get_url(url: str, *args, **kwargs) Optional[Resource][source]¶
- Return the API resource at the given URL. - Parameters:
- Returns:
- The resource at the given path. 
- Return type:
- Raises:
- rbtools.api.errors.APIError – The API returned an error. Details are in the error object. 
- rbtools.api.errors.ServerInterfaceError – There was a non-API error communicating with the Review Board server. The URL may have been invalid. The reason is in the exception’s message. 
 
 
 - login(*args, **kwargs) None[source]¶
- Log in to the Review Board server. - Parameters:
- Raises:
- rbtools.api.errors.APIError – The API returned an error. Details are in the error object. 
- rbtools.api.errors.ServerInterfaceError – There was a non-API error communicating with the Review Board server. The URL may have been invalid. The reason is in the exception’s message. 
 
 
 - logout(*args, **kwargs) None[source]¶
- Log out from the Review Board server. - Parameters:
- Returns:
- The return value from - logout().
- Return type:
- Raises:
- rbtools.api.errors.APIError – The API returned an error. Details are in the error object. 
- rbtools.api.errors.ServerInterfaceError – There was a non-API error communicating with the Review Board server. The URL may have been invalid. The reason is in the exception’s message. 
 
 
 
