Beautiful way of teaching. you completed step by step, repeating the mistakes & correcting those so that everyone can understand the reasons behind what u r doing.
Great introduction to an important topic! Do you have experience with the keyring library? It's very useful when the account running the program is logged in (at least in Windows; it works for MacOS and Linux too but I've only used it in Windows).
Heads up for anyone with the "FileNotFoundError: [Errno 2] No such file or directory:" - the file has to be in python's current working directory, which can be found using print(os.getcwd()) < Once found put your .env file in that location. Alternatively you can specify the file path, but you're exposing where the file is contained: file_path = '/full/path/to/.test' with open(file_path, 'r') as file: line = file.readline() print(line)
The way you explained it it very clear. very good! kudos! but still hiding your plain text keys in .env is insecure and big no for secure coding practice :)
Can we access macOS's keychain using python? p.s. from security standpoint isn't that easer for hacker to get creds from env variables rather than keychain?
I do the same thing with TOML files for settings and the tomllib library (or tomli for earlier python versions). But I wouldn't store plaintext secrets in files unless I had assurance from my admins that nobody but a select few users have read access to these files.
Beautiful way of teaching. you completed step by step, repeating the mistakes & correcting those so that everyone can understand the reasons behind what u r doing.
I love this method of teaching! You go through different mistakes that I would make and talk through how to correct it. Good job!
Thank you so much, much appriciated sir !
Thank you... Simple and crisp!
Very informative. Thank you!
Great introduction to an important topic! Do you have experience with the keyring library? It's very useful when the account running the program is logged in (at least in Windows; it works for MacOS and Linux too but I've only used it in Windows).
Heads up for anyone with the "FileNotFoundError: [Errno 2] No such file or directory:" - the file has to be in python's current working directory, which can be found using
print(os.getcwd()) < Once found put your .env file in that location. Alternatively you can specify the file path, but you're exposing where the file is contained:
file_path = '/full/path/to/.test'
with open(file_path, 'r') as file:
line = file.readline()
print(line)
The way you explained it it very clear. very good! kudos! but still hiding your plain text keys in .env is insecure and big no for secure coding practice :)
Thank you! Yes, of course, you should not store keys in .env on your production servers, but that's a good idea for the development
Are you familiar with a method to encrypt your .env file? I don't like storing any password as plaintext. Have you ever integrated a password manager?
Yes, I used that module: github.com/alexebaker/python-env_crypt
@@PythononPapyrus Very cool!
Can we access macOS's keychain using python?
p.s. from security standpoint isn't that easer for hacker to get creds from env variables rather than keychain?
But still you save a STRING of your password..
interesting
what?
эй , ты же русский) давай ка по русскому)
)
could use yaml and just load from a .gitignored pw file
I do the same thing with TOML files for settings and the tomllib library (or tomli for earlier python versions). But I wouldn't store plaintext secrets in files unless I had assurance from my admins that nobody but a select few users have read access to these files.