An API to update the google sheets when a request is received. It is developed in python
Project is created with:
- oauth2client: 4.1.3
- gspread: 3.7.0
- pandas: 1.0.4
- Flask: 1.1.2
Install the packages using pip:
pip install -r requirements.txt
- The api needs credentials to acess the google sheets, the credential can be obtained by contacting the developers.
- The credentials should be in creds.json file in the root directory of the repository.
- The api can be started by running the command
python main.py
- The api accepts POST request to
http:localhost:port/update
andhttp:localhost:port/updateBulk
- For single row update use
http:localhost:port/update
and for bulk update usehttp:localhost:port/updateBulk
. - The
http:localhost:port/update
accepts a JSON while the bulk update takes a list of JSON, where each JSON follows the template given below. - If using
http:localhost:port/update
, successive api call should have time interval of 2 seconds.
- The data can contain all the column from the COVID Bed Google Sheets.
- Required feilds:
Sheet Name
,Name
andCheck LAST UPDATED
. Rest are optional - The Check LAST UPDATED should be
True
orFalse
. - If Check LAST UPDATED flag is true, the dataformat for LAST UPDATED should be strictly
%Y-%m-%d %H:%M:%S
.
{
"Sheet Name": "Thanjavur Beds",
"Name":"Fake",
"URL":"https://www.google.com/maps/place/Thanjavur+Medical+College/@10.7580923,79.1035782,17z/data=!4m9!1m2!2m1!1sThanjavur+Medical+College!3m5!1s0x3baabf337761a613:0x69900b85db55755e!8m2!3d10.7586!4d79.1066!15sChlUaGFuamF2dXIgTWVkaWNhbCBDb2xsZWdlWiwKD21lZGljYWwgY29sbGVnZSIZdGhhbmphdnVyIG1lZGljYWwgY29sbGVnZZIBDm1lZGljYWxfc2Nob29ssAEA",
"COVID Beds": 226,
"Oxygen Beds":372,
"ICU": 200,
"Ventilator Beds": 500,
"LAST UPDATED": "2021-05-03 15:24:37",
"Check LAST UPDATED": False
}
gcloud app deploy