Python Quick Tip: Hiding Passwords and Secret Keys in Environment Variables (Mac & Linux)

preview_player
Показать описание
In this Python Programming Tutorial, we will be learning how to hide passwords and secret information within environment variables on Mac and Linux machines. Hard-coding secret information is a common mistake that beginners make when learning Python. Hiding this information within environment variables allows you to access your secret information within your code without anyone else being able to see these values from your source code. Let's get started...

The code from this video can be found at:

✅ Support My Channel Through Patreon:

✅ Become a Channel Member:

✅ One-Time Contribution Through PayPal:

✅ Cryptocurrency Donations:
Bitcoin Wallet - 3MPH8oY2EAgbLVy7RBMinwcBntggi7qeG3
Ethereum Wallet - 0x151649418616068fB46C3598083817101d3bCD33
Litecoin Wallet - MPvEBY5fxGkmPQgocfJbxP6EmTo5UUXMot

✅ Corey's Public Amazon Wishlist

✅ Equipment I Use and Books I Recommend:

▶️ You Can Find Me On:

#Python
Рекомендации по теме
Комментарии
Автор

Dude, you have some of the best tutorials on Youtube, students today (and everyone else) are very lucky to have your videos as a learning source. Thank you!

arctic-
Автор

Your way of teaching and examples are very hands-on and relatable. You have this amazing skill to make people understand with ease.

fahimalwasi
Автор

Now Mac uses zsh by default after Catalina update as I recall. For zsh users, I advise to type 'nano ~/.zshrc' in prompt instead of bash._profile.

gwanghyeongim
Автор

a newbie here, been looking for the os.environ for quite some times . and really you gave the clear explanation about it. Thank You!

Beyourselvestoachive
Автор

Your tip concerning "not leave a space between equal sign and quotes" saved my time. Thanks a lot!!!

senolkurt
Автор

It's amazing how you make hard topics so easy to understand. I am learning so much from you. Thanks for your work and help!

abhisheksaharan
Автор

I am thinking of changing my mobile phone's ringtone to Corey saying, "Hey, there! How it is going everybody." :D

psgpyc
Автор

Thanks for this! I was wondering how to easily protect my API keys when uploading python scripts to GitHub, this was great!

YashasLokesh
Автор

I've been searching for a solution like this for several days... this solved so many of my headaches.

FrocketGaming
Автор

Excellent Corey! Simply explained and demonstrated. Thanks!

marks_mindset_minutes
Автор

Very good, man. You re doing such a great work!!!

guilhermehx
Автор

Friends who are using Ubuntu 16.04, the file you're looking for is probably .profile in your home directory (if browsing there in the file system remember to hit ctrl+h to see hidden files) and do the exports just like Corey says in there. Personally I needed to restart my whole VM for it to take effect. Restarting my terminals and Pycham wasn't enough. Good luck! It's working great now for me, thanks Corey!

jx
Автор

I would suggest using keyring.

Btw. I too really enjoy your videos, very informative and to the point. Keep up the good work!

mathiaz
Автор

In my experience, environment variables also serve one important purpose other than maintaining secrecy. By using of environment variables instead of hard coded values I could easily roll out my project without worrying about the API keys and other settings used in the development version updated before uploading source code to the deployment server.🔥

rakeshpk
Автор

Thank you so much. I searched about half an hour for answer until I finally found your tutorial.

alex
Автор

Note that the standard shell for MacOS is zsh nowadays. Name the file .zshenv in that case OR run source ~/.bash_profile each time before running the server.
Similarly you can run source in your editor terminal to run create the environmental variables instead of restarting it.

HarmenHoek
Автор

LOVE IT, nobody has explained better! thanks a lot!

elgary
Автор

This was very helpful! Thank you very much!

dclassic
Автор

thank you for making sense of this for me - was struggling to understand it in text form only! :)

jessketches.
Автор

Thanks.. a long sought knowledge! thumbs-up!!

relax-bqij