Python Forum
Best practice for sharing gspread credentials to server
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best practice for sharing gspread credentials to server
#1
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.
Reply
#2
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Web scrapping login facebook credentials kosmas9 0 1,912 Aug-17-2020, 01:33 PM
Last Post: kosmas9
  How to resolve a 401 error, when the credentials work fine in a browser PyCurious 4 10,640 Apr-21-2020, 08:05 PM
Last Post: PyCurious

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020