I have replaced the Client's token attribute with an auth class. This class intercepts requests, ensuring the appropriate headers are attached. When instantiated, it will look for a token file and use that. If this file doesnt exist, no auth will be available until the user logs in. When users excecute a query whilst no auth file is available and they have not logged in a FileNotFoundError is raised instructing them to login:
Additionally, the auth class will catch authentication errors due to expired access tokens and issue a refresh token request, updating the client's stored access token.
Checklist
[x] Dependencies install correctly in a clean environment and code executes;
[ ] Test coverage extended; created tests fail without the change (if possible);
Description
Please explain the changes you made here.
I have replaced the
Client
'stoken
attribute with an auth class. This class intercepts requests, ensuring the appropriate headers are attached. When instantiated, it will look for a token file and use that. If this file doesnt exist, no auth will be available until the user logs in. When users excecute a query whilst no auth file is available and they have not logged in aFileNotFoundError
is raised instructing them to login:Additionally, the auth class will catch authentication errors due to expired access tokens and issue a refresh token request, updating the client's stored access token.
Checklist