Skip to content

Conversation

@konpsar
Copy link

@konpsar konpsar commented Dec 9, 2020

I had an idea to create a function that prompts for password (hiding it while typing), because I didn't like the idea to include my passwords in all .py scripts I used.

Added functions to _init_.py

  • login_prompt(...)
  • Constructor using login_prompt()

Notes

  • login_prompt is a wrapper function of existing login() function
  • Constructor was carefully created, in order not to brake older use cases.

Some use cases examples can be seen in examples.py which I've also updated.

Your feedback will be appreciated!

Added to extend login function to dynamically ask password/totp from user, hiding password while typing.
In this way, password doesn't have to be included in .py scripts.
Constructor enbales an option to automatically login when creating DeGiro instance. (using  login_prompt)
Updated examples to include some use cases of constructor and login_prompt.
Copy link

@Jakub-CZ Jakub-CZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embeding login into __init__ seems unnecessary (saving just one line of code), perhaps even a bit confusing. But as long as it doesn't break anything, no harm done.

@Jakub-CZ
Copy link

Jakub-CZ commented Dec 9, 2020

The way I dealt with password is that I import it (and other "secret" things) from __secrets__.py, which is a file that I never commit to GitHub.

It's very easy to implement, and I think it gives me the right balance of security and convenience, assuming my PCs are secure and trusted.

Some other options are:

  • place the secrets in a config file (.cfg) somewhere in your user home directory, and load them from there;
  • use something like keyring to store your password securely in your OS credentials store (it works on all major platforms).

konpsar and others added 3 commits December 10, 2020 09:27
Co-authored-by: Jakub Loucký <jakub.loucky@outlook.cz>
Co-authored-by: Jakub Loucký <jakub.loucky@outlook.cz>
Co-authored-by: Jakub Loucký <jakub.loucky@outlook.cz>
@konpsar
Copy link
Author

konpsar commented Dec 10, 2020

The way I dealt with password is that I import it (and other "secret" things) from __secrets__.py, which is a file that I never commit to GitHub.

It's very easy to implement, and I think it gives me the right balance of security and convenience, assuming my PCs are secure and trusted.

Some other options are:

  • place the secrets in a config file (.cfg) somewhere in your user home directory, and load them from there;
  • use something like keyring to store your password securely in your OS credentials store (it works on all major platforms).

Thanks for the feedback! The ways you propose are more practical. I will integrate them to my pipelines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants