PyClarify Auth¶
Copyright 2022 Searis AS
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- class pyclarify.jsonrpc.oauth2.Authenticator(clarify_credentials)¶
Bases:
object
- get_token()¶
Check if token exists or has expired, if yes get a new one, else return the old one.
- Returns:
Access token.
- Return type:
str
- read_credentials(clarify_credentials)¶
Read user credentials.
- Parameters:
clarify_credentials (str/dict) – The path to the clarify_credentials.json downloaded from the Clarify app, or json/dictionary of the content in clarify_credentials.json
- Returns:
Dictionary of the user credentials.
- Return type:
dict
- refresh_token()¶
Get a new token using the users credentials.
- Returns:
Access token.
- Return type:
str