PEP8
This commit is contained in:
parent
dc5ce1186f
commit
24a80dff35
1 changed files with 7 additions and 14 deletions
13
main.py
13
main.py
|
@ -53,7 +53,7 @@ else:
|
|||
if not os.path.exists(DATA_DIR):
|
||||
os.makedirs(DATA_DIR)
|
||||
|
||||
##### Logger stuff #####
|
||||
# Logger stuff
|
||||
|
||||
logger = logging.getLogger()
|
||||
|
||||
|
@ -80,8 +80,6 @@ if DEBUG:
|
|||
stream_handler.setFormatter(formatter)
|
||||
logger.addHandler(stream_handler)
|
||||
|
||||
########################
|
||||
|
||||
|
||||
TIMEDELTA_SYNCHRO = datetime.timedelta(days=15) # Number of days to look for
|
||||
# for synchronization
|
||||
|
@ -93,6 +91,7 @@ SCOPES = 'https://www.googleapis.com/auth/calendar'
|
|||
CLIENT_SECRET_FILE = 'client_secret.json'
|
||||
APPLICATION_NAME = 'Google Calendar API Python Quickstart'
|
||||
|
||||
|
||||
class Event:
|
||||
"""
|
||||
The event class allows a simple convertion between `icalendar.cal.Event`
|
||||
|
@ -181,6 +180,7 @@ def get_ntnoe():
|
|||
r = requests.get(url, auth=(NTNOE_ID, NTNOE_PASS))
|
||||
return r.content
|
||||
|
||||
|
||||
def main():
|
||||
"""Get the events on NTNOE the puts them on Google Calendar.
|
||||
"""
|
||||
|
@ -214,7 +214,6 @@ def main():
|
|||
|
||||
now = datetime.datetime.now()
|
||||
then = now + TIMEDELTA_SYNCHRO
|
||||
time_search = datetime.datetime(now.year, now.month, now.day, 1)
|
||||
|
||||
# NTNOE calendar often changes. So let's delete former synchronizations.
|
||||
logger.info('Deleting former events.')
|
||||
|
@ -232,12 +231,6 @@ def main():
|
|||
logger.info('Adding new events.')
|
||||
for e in ical.walk('VEVENT'):
|
||||
event = Event(e)
|
||||
t = (
|
||||
event.summary,
|
||||
event.start.isoformat(),
|
||||
event.end.isoformat(),
|
||||
event.location
|
||||
)
|
||||
if now >= event.end or event.start >= then:
|
||||
continue
|
||||
|
||||
|
|
Loading…
Reference in a new issue