项目作者: jonaylor89

项目描述 :
My Timesheet API cloud function
高级语言: Python
项目地址: git://github.com/jonaylor89/chronos.git
创建时间: 2020-01-16T04:47:17Z
项目社区:https://github.com/jonaylor89/chronos

开源协议:MIT License

下载


chronos

Overview

A gcloud function to pull google calendar data and present it as an easily accessible API. The function expects a calendar event as input
and responds with an array of how many hours each day are scheduled for that event this week.

Deployment

To deploy this gcloud function on your own account, first enable cloud functions and the google calendar API on the project you
plan to deploy to. Then from your console, make sure default auth is set up with:

  1. gcloud auth application-default login

Next, share your google calendar with the service account email for the cloud function
(something like whatever@serviceaccount.com in your IAM roles page) and lastly change the CALENDAR_ID variable in main.py
to your email and you should be set up. To deploy everything you should be able to run:

  1. $ ./deploy.sh

or if cloudbuild is enabled on the project and is set up with git integration for your gcloud project then just push


Send Request

  1. # Example checking how many hours each day you have "Work" scheduled
  2. curl -s -X POST $YOUR_FUNCTION_URL -H "Content-Type:application/json" -d '{"name":"Work"}'
  3. # => [0, 0, 0, 0, 0, 0, 0]

Response:

  1. [
  2. Sunday
  3. Monday
  4. Tuesday
  5. Wednesday
  6. Thursday
  7. Friday
  8. Saturday
  9. ]

Free software: MIT license