Logs your connection speed to a Google sheet. Tested and works with Raspberry Pi 3B, given relevant modules are installed (see below).
Uses the gspread
module.
The following is based on this video:
- Go to Google Developers Console and create a new project.
- Go to APIs & Services > Dashboard (left sidebar). Click
Enable APIs and Services
and enable the Google Sheets and Google Drive APIs. - Go to Credentials (left sidebar):
- Create credentials > Service account key
- Select
New service account
, give a service account name, and set the Role to Owner (steps will vary a little if the service account already exists and you're just adding a user) - Click
Create
(Key type should be set to JSON by default)
- Open the json and copy the client_email.
- Create a Google Sheet (or go to an existing one) and share that sheet with the client_email.
Notes:
- Mind you, you'll need the json file, sheet name and worksheet name for later.
- The code does not currently create a header row in the Google sheet, so you'll have to do it yourself (copy & paste should work):
timestamp ping dl ul server_id test_status . - You can pre-define a chart area in Google Sheets, so you can create a chart that populates as the data is registered.
- speedtest
(pip install speedtest-cli) - gspread
- ouath2client
- requests
- BeautifulSoup
All the things.
Exception and error handling. Break script to different modules. Stop using hard coded inputs. Better documentation. Some to-dos in the code itself. Package it all for practice? Learn how to check all dependencies are installed for practice (see requirements.txt)? If speedtest fails, mark timestamp of failed test?
- Gspread: github, documentation
- Pretty Printed - How to Use Google Sheets in Python (YouTube)
- Twilio: Google Spreadsheets and Python: post, video.
- Check out: