Skip to main content

TimeTree API SDK for Python

Project description

TimeTree SDK for Python

TimeTree API SDK for Python.

Installing

$ pip install 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

calenders = api.get_calendars()
print(calenders.data[0].attributes.name) # first calender 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 calender's label name

get_calendar_members

members = api.get_calendar_members('CALENDAR_ID')
print(members.data[0].attributes.name) # first calender'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

delete_event

status_code = api.delete_event('CALENDAR_ID', 'EVENT_ID')
print(status_code) # 204 on success

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

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

English: https://developers.timetreeapp.com/en/docs/api

Japanese: https://developers.timetreeapp.com/ja/docs/api

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timetree-sdk-0.1.3.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

timetree_sdk-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file timetree-sdk-0.1.3.tar.gz.

File metadata

  • Download URL: timetree-sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for timetree-sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c8bbd203dbc7bcec5da2374a08f3c7bf8229ad7afe296f3a58ef101edf275de4
MD5 b945fc4747eac36752168ca778e29577
BLAKE2b-256 7f94b1102cab3ab0f67992b5fdebddf6539d9c1650f0d25c83d0c4a03957da8d

See more details on using hashes here.

File details

Details for the file timetree_sdk-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: timetree_sdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7

File hashes

Hashes for timetree_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aecca81168ce4b7de4ef942f6f902d1fbdde96270c770dfed24d7063d9aabe1b
MD5 a326153a6766fdb04f694ec8e9b1b9dd
BLAKE2b-256 3151173c5a69ee80608862376782a1225210ba028e2ea41e19e018c428761991

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page