AnyDo API Python Documentation Release 0.0.2 Aliaksandr Buhayeu Apr 25, 2017
Contents 1 anydo_api unofficial AnyDo API client for Python (v0.0.2 aplha) 3 1.1 Supported Features............................................ 3 1.2 Requirements............................................... 3 1.3 Install................................................... 3 1.4 Usage & examples:............................................ 4 1.5 Contributions............................................... 7 2 Installation 9 3 Usage 11 4 Contributing 13 4.1 Types of Contributions.......................................... 13 4.2 Get Started!................................................ 14 4.3 Pull Request Guidelines......................................... 14 4.4 Tips.................................................... 15 5 Credits 17 5.1 Development Lead............................................ 17 5.2 Contributors............................................... 17 6 History 19 7 0.0.2 (2017-04-25) 21 8 0.0.1 (2015-10-12) 23 9 Indices and tables 25 i
ii
Contents: Contents 1
2 Contents
CHAPTER 1 anydo_api unofficial AnyDo API client for Python (v0.0.2 aplha) 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. Supported Features User CRUD operations Personal tasks CRUD and sharing Personal lists(categories) CRUD Requirements Automatically testing for Python 2.7 and Python 3.4. Uses requests>=2.8.0 for remote API calls. Install $ pip install anydo_api or directly from the repository: $ git clone https://github.com/aliaksandrb/anydo_api $ cd anydo_api $ python setup.py install 3
Usage & examples: 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: User management: >>> from anydo_api.client import Client Create totally new user: >>> user = Client.create_user(name='Garlic', email='name@garlic.com', password= 'password') Access to its attributes both ways: >>> user['name'] # > 'Garlic' >>> user.email # > 'name@garlic.com' Change the name: >>> user['name'] = 'Tomato' >>> user.save() # changes are pushed to server >>> user['name'] # > 'Tomato' Login with existent account: >>> user = Client(email='name@garlic.com', 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()... Tasks management: >>> from anydo_api.client import Client >>> from anydo_api.task import Task >>> user = Client(email='name@garlic.com', password='password').get_user() List tasks: >>> user.tasks() # > [] 4 Chapter 1. anydo_api unofficial AnyDo API client for Python (v0.0.2 aplha)
Create a new task: >>> task = Task.create( user=user, title='clean garden', priority='high', category='personal', repeatingmethod='task_repeat_off') >>> task['assignedto'] # > 'name@garlic.com' >>> 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... Lists(categories) management: >>> from anydo_api.client import Client >>> from anydo_api.category import Category >>> from anydo_api.task import Task >>> user = Client(email='name@garlic.com', 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'] 1.4. Usage & examples: 5
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']... & More complex example, task sharing: 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() # > [{'paca@garlic.com': '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': 'paca@garlic.com', '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() [{'paca@garlic.com': 'Paca'}, {'vaca@garlic.com': 'vaca@garlic.com'}]... For other methods and full support API check the docs or source code.. 6 Chapter 1. anydo_api unofficial AnyDo API client for Python (v0.0.2 aplha)
Contributions 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/. 1.5. Contributions 7
8 Chapter 1. anydo_api unofficial AnyDo API client for Python (v0.0.2 aplha)
CHAPTER 2 Installation At the command line: $ easy_install anydo_api Or, if you have virtualenvwrapper installed: $ mkvirtualenv anydo_api $ pip install anydo_api 9
10 Chapter 2. Installation
CHAPTER 3 Usage To use AnyDo API Python in a project: import anydo_api 11
12 Chapter 3. Usage
CHAPTER 4 Contributing Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given. You can contribute in many ways: Types of Contributions Report Bugs Report bugs at https://github.com/aliaksandrb/anydo_api/issues. If you are reporting a bug, please include: Your operating system name and version. Any details about your local setup that might be helpful in troubleshooting. Detailed steps to reproduce the bug. Fix Bugs Look through the GitHub issues for bugs. Anything tagged with bug is open to whoever wants to implement it. Implement Features Look through the GitHub issues for features. Anything tagged with feature is open to whoever wants to implement it. Write Documentation Every feature or new method should be documented and covered with a tests. 13
Submit Feedback The best way to send feedback is to file an issue at https://github.com/aliaksandrb/anydo_api/issues. If you are proposing a feature: Explain in detail how it would work. Keep the scope as narrow as possible, to make it easier to implement. Remember that this is a volunteer-driven project, and that contributions are welcome :) Get Started! Ready to contribute? Here s how to set up anydo_api for local development. 1. Fork the anydo_api repo on GitHub. 2. Clone your fork locally: $ git clone git@github.com:your_name_here/anydo_api.git 3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development: $ mkvirtualenv anydo_api $ cd anydo_api/ $ python setup.py develop 4. Create a branch for local development: $ git checkout -b name-of-your-bugfix-or-feature Now you can make your changes locally. 5. When you re done making changes, check that your changes pass pylint, pep257 and the tests, including testing other Python versions with tox: $ pylint anydo_api --rcfile=./.pylintrc $ python setup.py test $ tox To get a tox, just pip install them into your virtualenv. 6. Commit your changes and push your branch to GitHub: $ git add. $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature 7. Submit a pull request through the GitHub website. Pull Request Guidelines Before you submit a pull request, check that it meets these guidelines: 1. The pull request should include tests. 14 Chapter 4. Contributing
2. If the pull request adds functionality, the docs should be updated. Put your new functionality into a function with a docstring, and add the feature to the list in README.rst. 3. The pull request should work for Python 2.7 and 3.4. Check https://travis-ci.org/aliaksandrb/anydo_api/pull_ requests and make sure that the tests pass for all supported Python versions. Tips To run a subset of tests: $ python -m unittest tests.test_client Thanks a lot! 4.4. Tips 15
16 Chapter 4. Contributing
CHAPTER 5 Credits Development Lead Aliaksandr Buhayeu <aliaksandr.buhayeu@gmail.com> Contributors None yet. Why not be the first? 17
18 Chapter 5. Credits
CHAPTER 6 History 19
20 Chapter 6. History
CHAPTER 7 0.0.2 (2017-04-25) Fix issue with an uuid generation on Py3. 21
22 Chapter 7. 0.0.2 (2017-04-25)
CHAPTER 8 0.0.1 (2015-10-12) First release on PyPI. 23
24 Chapter 8. 0.0.1 (2015-10-12)
CHAPTER 9 Indices and tables genindex modindex search 25