toggltrack.py
def startTimeEntry(requests, desc, pid, wid, auth):
    """
    desc: description for the entry
    pid: project id
    wid: workspace id
    """

    headers = {
        'Content-Type': 'application/json',
        'Authorization': auth
    }

    data = '{"time_entry":{"description":"' + desc + '",'
    data += '"pid":' + pid + ','
    data += '"wid":' + wid + ','
    data += '"created_with":"curl"}' + '}'
    print('[debug] header')
    print(headers)
    print('[debug] data')
    print(data)

    uri = 'https://api.track.toggl.com/api/v8/time_entries/start'
    # response = requests.post(uri,
    #                          headers=headers, data=data,
    #                          auth=(auth, 'api_token'))
    response = requests.post(uri, headers=headers, data=data)
    print('[debug] response.status_code')
    print(response.status_code)
    print('[debug] response.text')
    print(response.text)
    print()
    py_dict = json.loads(response.text)
    entry_id = py_dict['data']['id']
    print('[debug] time entry id:', entry_id)
    print()

    return entry_id

    desc: description for the entry
    pid: project id
    wid: workspace id
    
description for the entry
pid: project id
wid: workspace id
description for the entry pid : project id wid : workspace id
def startTimeEntry(requests, desc, pid, wid, auth):
    headers = {
        'Content-Type': 'application/json',
        'Authorization': auth
    }
    data = '{"time_entry":{"description":"' + desc + '",'
    data += '"pid":' + pid + ','
    data += '"wid":' + wid + ','
    data += '"created_with":"curl"}' + '}'
    print('[debug] header')
    print(headers)
    print('[debug] data')
    print(data)
    uri = 'https://api.track.toggl.com/api/v8/time_entries/start'
    response = requests.post(uri, headers=headers, data=data)
    print('[debug] response.status_code')
    print(response.status_code)
    print('[debug] response.text')
    print(response.text)
    print()
    py_dict = json.loads(response.text)
    entry_id = py_dict['data']['id']
    print('[debug] time entry id:', entry_id)
    print()
    return entry_id
def startTimeEntry ( requests , desc , pid , wid , auth ) : headers = { 'Content-Type' : 'application/json' , 'Authorization' : auth } data = '{"time_entry":{"description":"' + desc + '",' data += '"pid":' + pid + ',' data += '"wid":' + wid + ',' data += '"created_with":"curl"}' + '}' print ( '[debug] header' ) print ( headers ) print ( '[debug] data' ) print ( data ) uri = 'https://api.track.toggl.com/api/v8/time_entries/start' response = requests . post ( uri , headers = headers , data = data ) print ( '[debug] response.status_code' ) print ( response . status_code ) print ( '[debug] response.text' ) print ( response . text ) print ( ) py_dict = json . loads ( response . text ) entry_id = py_dict [ 'data' ] [ 'id' ] print ( '[debug] time entry id:' , entry_id ) print ( ) return entry_id
desc: description for the entry
pid: project id
wid: workspace id
desc : description for the entry pid : project id wid : workspace id
"""
    desc: description for the entry
    pid: project id
    wid: workspace id
    """ # response = requests.post(uri, #                          headers=headers, data=data, #                          auth=(auth, 'api_token'))
requests
desc
pid
wid
auth