Python Forum

Full Version: Best practice for sharing gspread credentials to server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm using gspread (to write data to Google spreadsheet) and my app runs on Heroku.
I credentials json file (for gspread), that I don't want to put on Git and I can't manually upload to Heroku.
What is the best way access this data in the server so that my code can run there as well? maybe write some of the information in environment variables and read it in my app?

This is the code that I have now:
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive'    
credentials = ServiceAccountCredentials.from_json_keyfile_name('credentials.json', scope)
Thanks.
Assuming that the environment variable definition is relatively secure, yes, that sounds like a decent way to go. I'm no Heroku expert, so there might be a better way, but I've seen env vars used in Jenkins successfully.