-
Notifications
You must be signed in to change notification settings - Fork 154
Added Security Measures #68
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
base: master
Are you sure you want to change the base?
Changes from all commits
d4671a1
93059bd
1340dd4
d73b2ca
619bd6a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,3 +3,5 @@ websocket_client | |
| ./dist/NorenRestApiPy-0.0.20-py2.py3-none-any.whl | ||
| pandas | ||
| pyyaml | ||
| pyotp | ||
| load_dotenv | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,28 @@ | ||
| from api_helper import ShoonyaApiPy | ||
| import logging | ||
| from dotenv import load_dotenv | ||
|
|
||
| #enable dbug to see request and responses | ||
| logging.basicConfig(level=logging.DEBUG) | ||
|
|
||
| #start of our program | ||
| api = ShoonyaApiPy() | ||
|
|
||
| #credentials | ||
| user = <uid> | ||
| pwd = <password> | ||
| factor2 = <2nd factor> | ||
| vc = <vendor code> | ||
| app_key = <secret key> | ||
| #create .env file to securely access user credentials in program | ||
| load_dotenv('/home/akash/Documents/Projects/.env') | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not hardcode stuff from your local setup. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. even it better if it can initialize from user env. that means system variable what do you think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes that way |
||
|
|
||
| #totp from shoonya dashboard security totp section | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not clear what this is referring to. Is this suggesting to fetch the value of |
||
| token = os.getenv('totp') | ||
| otp = pyotp.TOTP(token).now() | ||
|
|
||
| #os.getenv() will fetch values from .env file | ||
| #credentials | ||
| uid = os.getenv('userid') | ||
| pwd = os.getenv('password') | ||
| vc = os.getenv('vendor_code') | ||
| app_key = os.getenv('api_key') | ||
| imei = <imei> | ||
| factor2 = otp | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of pushing commits with issues and separate commits to fix them, |
||
|
|
||
| #make the api call | ||
| ret = api.login(userid=uid, password=pwd, twoFA=factor2, vendor_code=vc, api_secret=app_key, imei=imei) | ||
|
|
||
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.
Why is this not merged yet?
the
uservariable is not usedwhen
api.loginis called,useridis assigned a value fromuidwhich is not defined