watson_developer_cloud.iam_token_manager module

class IAMTokenManager(iam_apikey=None, iam_access_token=None, iam_url=None)[source]

Bases: object

request(method, url, headers=None, params=None, data=None, **kwargs)[source]
get_token()[source]

The source of the token is determined by the following logic: 1. If user provides their own managed access token, assume it is valid and send it 2. If this class is managing tokens and does not yet have one, make a request for one 3. If this class is managing tokens and the token has expired refresh it. In case the refresh token is expired, get a new one If this class is managing tokens and has a valid token stored, send it

set_access_token(iam_access_token)[source]

Set a self-managed IAM access token. The access token should be valid and not yet expired.

set_iam_apikey(iam_apikey)[source]

Set the IAM api key