I’m trying to make a file within visual studio code that holds my API key and secret key. so when I do future codes I can just import that file into my code without having to write my API keys every time.
I’ve tried this
api key = ‘cewhjhbdhbd’
secret key = ‘jhewbduywevb’
tried to save it.. it saved in documents and when I tried to import it nothing happened.. where am I going wrong?
I am a beginner at coding so sorry if this is obvious.
2
Answers
You can use environment variables for this.
You can then import this file or use the above block of code in your files.
Use an environment file like .env to store your API keys. In a format like
Then you can use packages like dotenv to access them.