用于组合日历的api的python包装器
pyTeamUp的Python项目详细描述
Pyteamup
用于组合api的python api包装器。在早期阶段,只实现了事件和日历对象。
版本:0.1.1a
特点:
- pythonic访问组合日历和事件。
- 用于收集子日历和事件容器的简单接口。
- 使用
Calendar
对象创建和删除事件的简单界面 Event
对象具有更新事件属性的简单接口- 用于减少更新多个事件属性的API调用的批处理模式
- 如果存在pandas,calendar可以将事件作为series对象返回,将事件集合作为dataframe对象返回
示例用法
frompyteamupimportCalendar,Eventfromdatetimeimportdatetimeapi_key='example api key'# Get your own here: https://teamup.com/api-keys/requestcalendar_id='example calendar id'# goto www.teamup.com to sign up and get your own calendar# Instantiate the calendarcalendar=Calendar(calendar_id,api_key)# Get Subcalendarssubcalendars=calendar.subcalendarssubcal=subcalendars[0]# Easily Create new eventsnew_event_dict={'title':'New Event Title','start_dt':datetime(2018,11,29,14,0,0),'end_dt':datetime(2018,11,29,14,0,0),'subcalendar_ids':subcal['id'],'notes':'This is the description!'}new_event=Calendar.new_event(**new_event_dict,returnas='event')print(new_event.event_id)# Gather Event Collections (returns a list)event_list=Calendar.get_event_collection()evnt=event_list.pop()# Simple change of the titleprint(evnt.title)evnt.title='New Title'print(evnt.title)# Batch Mode Updatesevnt.enable_batch_mode()evnt.title='New Title 2'# Will display a warning that no changes are made until batch_commit() is calledprint(evnt.title)# Will still print the old titleprint(evnt.notes)evnt.notes='New Notes!'# Will display a warning that no changes are made until batch_commit() is calledevnt.batch_commit()print(evnt.title)print(evnt.notes)# Prevented from Editing Read-Only Attributesevnt.event_id=123# Will raise an error because attribute is read-only# Easy Delete and confirmevnt.delete()print(evnt.is_deleted)# Will return True
待办事项
- 添加对更新定期事件的支持
- 使用类似于事件对象的更新支持来生成子日历对象
- 添加测试
- 添加更多日历终结点(搜索事件)
- 添加访问密钥终结点
- 添加色样查找(为红色、蓝色、绿色等创建简单的指定)
- 添加对密码保护日历的支持
- 添加对测试版功能的支持:撤消、自定义字段、注释、注册
安装
使用PIP当前版本:0.1.0a1):
python -m pip install pyTeamUp
批处理模式
events对象具有批处理模式,可以通过一个api调用设置多个值,减少api的使用,并减少协作禁用api密钥的可能性!只需调用event.enable_batch_mode()
并开始进行更改。当满意的更改可以通过调用^ {CD4}}来实现,它将自动退出批处理模式,或调用^ {< CD5> }以放弃更改。
在不启用批处理模式的情况下设置事件数据将导致每个更改使用一个api请求。
问题
请使用问题跟踪器:)
常见问题解答
无
更改日志
0.1.1a
- 固定版本控制
- 修复了文件名,修复了导入错误
0.1.0a2
- 将“获取已更改的事件”方法添加到日历(credit:vranki)
0.1.0a1
- 初始真实性