onedrive.auth module¶
Authenticate with OneDrive’s API and make authenticated HTTP requests.
- class onedrive.auth.OneDriveOAuthClient(authorize=False)[source]¶
Bases: builtins.object
Interface for dancing with OneDrive’s OAuth.
Parameters: authorize : bool, optional
If authorize is True, authorize the client and generate a new refresh token (requires tty interaction); otherwise, assume the refresh token is already present in the config file, and raise if it is not available.
Returns: OSError
If the config file or any necessary config section/parameter is missing.
- API_ENDPOINT = 'https://api.onedrive.com/v1.0/'¶
Authorize the client using the code flow.
- request(method, url, **kwargs)[source]¶
HTTP request with OAuth and safeguards.
The noretry keyword argument is used internally to determine if another attempt should be made on a timeout, or HTTP 429 (Too Many Requests), 500 (Internal Server Error), or 503 (Service Unavailable). The default value is True.