Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Template
AutoCalender -
**from future import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from task import Task
from datetime import timedelta, datetime
categories = {
# Lavender
'#a4bdfc': '',
# Blueberry
'#5484ed': '',
# Peacock
'#46d6db': 'Exercise',
# Sage
'#7ae7bf': 'My Apps',
# Basil
'#51b749': 'App',
# Tangerine
'#ffb878': '',
# Banana
'#fbd75b': '',
# Flamingo
'#ff887c': '',
# Tomato
'#dc2127': 'YouTube',
# Mandarine
'#fa573c': '',
# Grape
'#dbadff': 'Work',
# Graphite
'#e1e1e1': 'School'
}
EVENTS_TO_LOOK_THROUGH = 60
If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
def main():
"""Shows basic usage of the Google Calendar API.
Prints the start and name of the next 10 events on the user's calendar.
"""
creds = None
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server()
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)
def parse_time(timestamp):
# Takes a timestamp string and returns a datetime object
try:
time_object = datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S%z")
except ValueError:
# If no start and end time is specified the format string must be different
time_object = datetime.strptime(timestamp, "%Y-%m-%d")
return time_object
def format_timedelta(timedelta):
# Takes a timedelta and returns a string
hours = timedelta.total_seconds() / 3600
return("%.2f" % hours)
if name == 'main':
main()
**
Issue no.(must) -
Self Check(Tick After Making pull Request)
If issue was not assigned to you Please don't make a PR. It will marked as invalid.