Esempio n. 1
0
    def test_add(self):
        # time entry has no data, raises an exception
        self.assertRaises(Exception, self.entry.add)

        # create basic entry and add it
        start_time = toggl.DateAndTime().now()
        self.entry = toggl.TimeEntry(description=desc('add'),
            start_time=start_time, duration=10)
        self.entry.add()

        # make sure it shows up in the list
        entry = self.find_time_entry(desc('add'))
        self.assertIsNotNone(entry)
        self.assertEquals(entry.get('duration'), 10)
Esempio n. 2
0
 def setUp(self):
     self.dat = toggl.DateAndTime()
#!/usr/bin/env python

import argparse
from datetime import datetime, date, timedelta
import dateutil.parser
import toggl
import logging
import json
import pytz
import gspread
from oauth2client.service_account import ServiceAccountCredentials

service_scope = ['https://spreadsheets.google.com/feeds']

UTC = pytz.timezone("UTC")
localtz = toggl.DateAndTime().tz


def fd(d):
    """formats a date in the local timezone in isoformat"""
    d = localtz.localize(d)
    return d.isoformat()


def get_entries(start_date, end_date, client=None):
    finished = False
    start_search, end_search = start_date, end_date
    # TODO: This is a manual way to search through time entry list pages. Switch to reports API rather
    if client:
        projects = toggl.ProjectList()
        valid_project_ids = {