Finish saving & loading projects-clients mapping from Harvest API and document
This commit is contained in:
parent
e1a2b0cd8b
commit
6aaaffd45b
4 changed files with 26 additions and 6 deletions
10
settings.py
10
settings.py
|
@ -1,11 +1,14 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import configparser
|
||||
import json
|
||||
import os
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config['pomodoro'] = {}
|
||||
pomodoro = config['pomodoro']
|
||||
config['harvest'] = {}
|
||||
harvest = config['harvest']
|
||||
|
||||
def write():
|
||||
with open('settings.ini', 'w') as configfile:
|
||||
|
@ -37,3 +40,10 @@ def pomodoro_latest_recorded(timestamp = None):
|
|||
write()
|
||||
else:
|
||||
return pomodoro.get('latest_recorded', None)
|
||||
|
||||
def harvest_set_projects_clients_map(projects_clients_map = {}):
|
||||
config.set('harvest', 'projects_clients', json.dumps(projects_clients_map))
|
||||
write()
|
||||
|
||||
def harvest_get_projects_clients_map():
|
||||
return json.loads(harvest['projects_clients'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue