This simple client library provides access to basic features of AnyDo task manager in a easy and object-oriented style.
It could be used for own projects integration's or as a tool for migration from one task manager to another.
- User CRUD operations
- Personal tasks CRUD and sharing
- Personal lists(categories) CRUD
- Automatically testing for Python 2.7 and Python 3.4.
- Uses requests>=2.8.0 for remote API calls.
$ pip install anydo_api
or directly from the repository:
$ git clone https://github.com/aliaksandrb/anydo_api $ cd anydo_api $ python setup.py install
Currently not all functionality from the original Chrome/Android/.. clients are supported. Some of them just have no sense for console client, some just not ready yet :)
Here is what we have for now:
>>> from anydo_api.client import Client
Create totally new user:
>>> user = Client.create_user(name='Garlic', email='[email protected]', password='password')
Access to its attributes both ways:
>>> user['name'] # > 'Garlic'
>>> user.email # > '[email protected]'
Change the name:
>>> user['name'] = 'Tomato'
>>> user.save() # changes are pushed to server
>>> user['name'] # > 'Tomato'
Login with existent account:
>>> user = Client(email='[email protected]', password='password').get_user()
>>> user['name'] # > 'Tomato'
Get the possible updates from the server (in case if user was already instantiated but changed by other client/app)
>>> user.refresh()
Delete your account completely. Warning! Can't be undone:
>>> user.destroy()
...
>>> from anydo_api.client import Client
>>> from anydo_api.task import Task
>>> user = Client(email='[email protected]', password='password').get_user()
List tasks:
>>> user.tasks() # > []
Create a new task:
>>> task = Task.create(
user=user,
title='Clean garden',
priority='High',
category='Personal',
repeatingMethod='TASK_REPEAT_OFF')
>>> task['assignedTo'] # > '[email protected]'
>>> task.status # > 'UNCHECKED'
Add note for task:
>>> task.add_note('first task')
>>> task.notes() # > ['first task']
Add a subtasks:
>>> subtask = Task.create(user=user, title='Find a water', priority='Normal')
>>> task.add_subtask(subtask)
>>> subtask.parent()['title'] # > 'Clean garden'
>>> task.subtasks()[0]['title'] # > 'Find a water'
Check the task:
>>> subtask['status'] # > 'UNCHECKED'
>>> subtask.check()
>>> subtask['status'] # > 'CHECKED'
Delete the task:
>>> subtask.destroy()
>>> len(user.tasks()) # > 2
>>> len(user.tasks(refresh=True)) # > 1
...
>>> from anydo_api.client import Client
>>> from anydo_api.category import Category
>>> from anydo_api.task import Task
>>> user = Client(email='[email protected]', password='password').get_user()
List categories:
>>> list(map(lambda category: category['name'], user.categories())) # > ['GROCERY LIST', 'PERSONAL ERRANDS']
Create a new category:
>>> category = Category.create(user=user, name='Home')
>>> list(map(lambda category: category['name'], user.categories(refresh=True)))
# > ['GROCERY LIST', 'PERSONAL ERRANDS', 'Home']
List category tasks:
>>> category.tasks() # > []
>>> task = Task.create(user=user, title='In new category', priority='Normal')
>>> category.add_task(task)
>>> category.tasks()[0]['title'] # > 'In new category'
Make category default one, for new tasks:
>>> category.default # > False
>>> category.mark_default()
>>> category.default # > True
Delete the category:
>>> category.destroy()
>>> list(map(lambda category: category['name'], user.categories(refresh=True)))
# > ['GROCERY LIST', 'PERSONAL ERRANDS']
...
Assume we have two users: Paca and Vaca. User Paca has a one task it wants to share with Vaca.
>>> task = paca.tasks()[0]
>>> task['title'] # > 'Paca Task'
>>> task.members() # > [{'[email protected]': 'Paca'}]
Share task with user:
>>> task.share_with(vaca)
Until task isn't approved it isn't shared:
>>> vaca.tasks() # > []
>>> vaca.pending_tasks()
# > [{'id': 'm8cEmJJFXgYWrr3Xplj9zw==', 'invitedBy': {'name': 'Paca', 'email': '[email protected]', 'picture': None}, 'message': None, 'title': 'Paca Task'}]
Approve the pending task:
>>> vaca.approve_pending_task(pending_task=vaca.pending_tasks()[0])
And now it is shared:
>>> vaca.tasks()[0]['title'] # > 'Paca Task'
>>> task.members()
[{'[email protected]': 'Paca'}, {'[email protected]': '[email protected]'}]
...
For other methods and full support API check the docs or source code..
Feedback, issue reports and feature/pull requests are greatly appreciated! You could post them into issues.
Generic guide for contributions is placed here.
Thanks!
- MIT license
- Automaticaly generated documentation: http://anydo-api.readthedocs.org/en/latest/.