-
-
Notifications
You must be signed in to change notification settings - Fork 83
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
Improve handling of multiple credentials #144
base: master
Are you sure you want to change the base?
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.
That aside, being able to store multiple credentials seems like a useful feature to have👍
@@ -19,14 +19,13 @@ def get_settings(tr): | |||
return formatted_json | |||
|
|||
|
|||
def login(phone_no=None, pin=None, web=True): | |||
def login(phone_no=None, pin=None, web=True, store_credentials=True): |
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.
def login(phone_no=None, pin=None, web=True, store_credentials=True): | |
def login(phone_no=None, pin=None, web=True, store_credentials=False): |
"--store_credentials", | ||
help="Store credentials (Phone number and pin) for next usage", | ||
action="store_true", | ||
default=True |
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.
I wouldn't save the credentials in a clear file per default when this behavior is not explicitly highlighted to the user.
default=True |
log.info("Credentials not saved") | ||
|
||
tr = TradeRepublicApi(phone_no=phone_no, pin=pin, save_cookies=save_cookies) | ||
tr = TradeRepublicApi(phone_no=phone_no, pin=pin, save_cookies=True) |
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.
Same critique here, the default behavior should not be to leave clear file cookies on your system indefinitely.
tr = TradeRepublicApi(phone_no=phone_no, pin=pin, save_cookies=True) | |
else: | |
save_cookies = False | |
log.info("Credentials not saved") | |
tr = TradeRepublicApi(phone_no=phone_no, pin=pin, save_cookies=save_cookies) |
Hi,
I'm taking another attempt to fix #38 (Session is not invalidated when a new login with different number occurs) which hits me as well. There has already be an effort in #56 but it seems that this went stale.
My idea is to store the cookies in a file that is named after the phone number which is the id of a trade republic account. So there can be no conflicts in cookies if the tool is used with multiple accounts.
I also remove the prompt that asks whether one would like to save the credentials and replace it with a command line option
--store_credentials
which defaults to true. I find the prompt rather annoying, especially for scripted calls of pytr.Comments/Suggestions?
Cheers
Christoph