TimeTree SDK for Python
TimeTree API SDK for Python.
Installing
$ pip install tooniez-timetree-sdk
Usage
from timetree_sdk import TimeTreeApi
api = TimeTreeApi('API_ACCESS_TOKEN')
calendar = api.get_calendar('CALENDAR_ID')
print(calendar.data.attributes.name) # calendar name
API
Oauth
get oauth authorize url
oauth_authorize_url = TimeTreeApi.get_oauth_authorize_url('CLIENT_ID', 'REDIRECT_URI', 'RESPONSE_TYPE', 'STATE')
User
get current user
user = api.get_current_user()
print(user.data.attributes.name) # user name
Calendar
get calendars
calendars = api.get_calendars()
print(calendars.data[0].attributes.name) # first calendar name
get calendar
calendar = api.get_calendar('CALENDAR_ID')
print(calendar.data.attributes.name) # calendar name
get calendar labels
labels = api.get_calendar_labels('CALENDAR_ID')
print(labels.data[0].attributes.name) # first calendar's label name
get calendar members
members = api.get_calendar_members('CALENDAR_ID')
print(members.data[0].attributes.name) # first calendar's member name
Event
get event
event = api.get_event('CALENDAR_ID', 'EVENT_ID')
print(event.data.attributes.title) # event title
get upcoming events
events = api.get_upcoming_events('CALENDAR_ID', 'Asia/Tokyo', 7)
print(events.data[0].attributes.title) # most recent event title in 7 days
create event
event = Event(
data=EventData(
attributes=EventAttributes(
title='Title',
category='schedule',
all_day=False,
start_at='2020-04-04T11:00:00.000Z',
end_at='2020-04-04T13:00:00.000Z',
description='Description',
location='Location',
start_timezone='Japan',
end_timezone='Japan'
),
relationships=EventRelationships(
label=EventRelationshipsLabel(
data=EventRelationshipsLabelData(
id='LABEL_ID',
type='label'
)
),
attendees=EventRelationshipsAttendees(
data=[EventRelationshipsAttendeesData(
id='USER_ID',
type='user'
)]
)
)
)
)
response = api.create_event('CALENDAR_ID', event)
print(response.data.attributes.title) # Title
update event
event = Event(
data=EventData(
attributes=EventAttributes(
title='Updated Title',
category='schedule',
all_day=False,
start_at='2020-04-04T11:30:00.000Z',
end_at='2020-04-04T13:30:00.000Z',
description='Description',
location='Location',
start_timezone='Japan',
end_timezone='Japan'
),
relationships=EventRelationships(
label=EventRelationshipsLabel(
data=EventRelationshipsLabelData(
id='LABEL_ID',
type='label'
)
),
attendees=EventRelationshipsAttendees(
data=[EventRelationshipsAttendeesData(
id='USER_ID',
type='user'
)]
)
)
)
)
response = api.create_event('CALENDAR_ID', 'EVENT_ID', event)
print(response.data.attributes.title) # Updated Title
delete event
status_code = api.delete_event('CALENDAR_ID', 'EVENT_ID')
print(status_code) # 204 on success
Event Comment
create comment to event
comment = EventComment(
data=EventCommentData(
attributes=EventCommentAttributes(
content='Hello, world'
)
)
)
event_comment = api.create_event_comment('CALENDAR_ID', 'EVENT_ID', comment)
print(event_comment.data.attributes.content) # Hello, world
Documentation
Official API documentation
Metadata
Release files for tooniez-timetree-sdk 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tooniez-timetree-sdk-0.0.5.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tooniez_timetree_sdk-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.3 kB
Release files / tooniez-timetree-sdk-0.0.5.tar.gz
| Download URL | tooniez-timetree-sdk-0.0.5.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd039c342bb1a35792458c216ef48e492ac2ffbda63bea3dcf42c8438ce6a5ea
|
|
BLAKE2b-256 checksum How to use checksums |
4844360fee54c9e0eac79e0c86499a4471af056c7087396dfa8eb080d06956d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / tooniez_timetree_sdk-0.0.5-py3-none-any.whl
| Download URL | tooniez_timetree_sdk-0.0.5-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5f3513930e65a78ea2fba08e8cad85981880bfd4370bffca20d7e58eb8932645
|
|
BLAKE2b-256 checksum How to use checksums |
56cd63bd166a102d721e02a0805acf6a644417b1d560c3ab6f4c42c9bed6e9b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|