google token generator
Project description
how to use
from gcpTokenGenerator import tokenGenerator
conf = {
"STG_Conf": {
"account": '{your service account}', # need to get from dev ops
"host": '{your project id}',
"target_audience": '{your client id}',
"iap": True,
},
"PRD_Conf": {
"account": '{your service account}', # need to get from dev ops
"host": '{your project id}',
"target_audience": '{your client id}',
"iap": True,
}
}
instance = tokenGenerator(conf)
token = instance.generateToken('STG_Conf')
print('token', token)
- when reusing same instance, generated token will renew the token only if it's expired after one hour
meaning it remember the last token generated to one of the configs was used on init
example:
from gcpTokenGenerator import tokenGenerator
conf = {
"STG_Conf": {
"account": '{your service account}', # need to get from dev ops
"host": '{your project id}',
"target_audience": '{your client id}',
"iap": True,
},
"PRD_Conf": {
"account": '{your service account}', # need to get from dev ops
"host": '{your project id}',
"target_audience": '{your client id}',
"iap": True,
}
}
instance = tokenGenerator(conf)
stg_token = instance.generateToken('STG_Conf')
prd_token = instance.generateToken('PRD_Conf')
print('stg_token', stg_token)
print('prd_token', prd_token)
# this will generate new token only if it's expired
stg_token = instance.generateToken('STG_Conf')
prd_token = instance.generateToken('PRD_Conf')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for gcpTokenGenerator-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12970077b1981076829f332d1a83b6037cea6328a096a85050e7e67c311bb11c |
|
MD5 | 7754a9f9a63ae3ef08d0e2dabadc5961 |
|
BLAKE2b-256 | b80c267d28f4be26e2f7664e7c6486dfdc199abe75bbca9135f128d5f0ad1ff3 |