In long-running scripts which make calls using the Python wrapper for Domino's REST api, python-domino, depending on your authentication scenario you might encounter 403 Forbidden errors as a result of the JWT token expiring.
One way to workaround or prevent such expiration is to re-authenticate via the authenticate() method added in version 1.04 of the binding:
def authenticate(self, api_key=None, auth_token=None, domino_token_file=None):
For example:
from domino import Domino
domino = Domino("integration-test/quick-start")
# do stuff, then sleep long enough to tickle something an “Access token lifespan"
time.sleep(360)
domino.authenticate(domino_token_file = os.environ['DOMINO_TOKEN_FILE'])
# do more stuff that would hit an expired token and result in
# a 403 Forbidden for the wrapper's REST request if it weren't for the re-authentication you just made
Comments
0 comments
Please sign in to leave a comment.