Create, Read, Update, and Delete entries using a Google Sheet for storage
Get a Binaris API Key and a google project + credentials and a usable spreadsheet from Google Docs.
# Install the Binaris CLI
$ npm install -g binaris
# Set your API key in ~/.binaris.yml
$ bn login
# Clone this repo
$ git clone [email protected]:binaris/functions-examples.git
$ cd functions-examples/python-crud-google-spreadsheet
# After cloning the repo, move your credentials into the repo working directory
$ cp {path-to-credentials} ./credentials.json
# Pull the bob repo, and run the build scrip to compile the pip dependencies.
$ git clone [email protected]:binaris/bob.git
$ ./bob/build.sh 3
# Set the environment variables for deployment
# The spreadsheet id can be located in the spreadsheet url
$ export SPREADSHEET_ID={your-designated-spreadsheet-id}
# Deploy the functions:
$ ./deploy.sh
# Use the endpoints supplied to create, read, and modify data in the sheet using the binaris CLI or curl commands
$ bn invoke create_endpoint --data '{"row": [1, 2, 3, 4, 5]}'
$ curl -H X-Binaris-Api-Key:{your-binaris-api-key} 'https://run.binaris.com/v2/run/{your-account-id}/read_endpoint?row_number={row-number}'
$ curl -H X-Binaris-Api-Key:{your-binaris-api-key} --data '{"row": [3, "text", 2]}' 'https://run.binaris.com/v2/run/{your-account-id}/update_endpoint?row_number={row-number}'
$ curl -H X-Binaris-Api-Key:{your-binaris-api-key} 'https://run.binaris.com/v2/run/{your-account-id}/delete_endpoint?row_number={row-number}'
Proposed changes should adhere to the Python PEP8 style guide, and can be checked using pylint.
# Install pylint
$ pip3 install pylint --upgrade
# Run style check on src directory
$ pylint src/