-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Credentials class refactor #848
Credentials class refactor #848
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
So much better than what was there before!!
@andy-esch Your work was and is awesome! This is the easy part |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the party
Just a suggestion, we have some code in carto-python to get the username from the base_url it might be useful
if isinstance(credentials, Credentials): | ||
return cls(credentials.api_key, credentials.username, credentials.base_url, credentials.session) | ||
|
||
raise ValueError('`credentials` must a Credentials class instance') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo -> must be
👼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #850
with open(config_file or _DEFAULT_PATH, 'r') as f: | ||
credentials = json.load(f) | ||
|
||
return cls(credentials.get('api_key'), credentials.get('username')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this makes the saved credentials not to work in on-premises environments, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, it is a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in #850
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch!!
It is not late! We can do the stuff in the "main PR" |
Refactor of the Credentials class
The first step of #661
In order to avoid a huge PR review like the last one, I am going to create several like this one. The objective is to allow you to check the structure or the idea since the tests are not going to be green. Then, in the main PR (using
feature/credentials-refactor
) we will see all together.If you see a better way, please let me know