Coder Social home page Coder Social logo

wunderpy2's Introduction

Overview

Wunderpy2 is a thin Python library for accessing the official Wunderlist 2 API. What does a thin library mean here?

  1. Only the bare minimum of error-checking to pass the Wunderlist API specifications is performed (e.g. there's no checking whether a task's title is empty, even though the Wunderlist web client enforces nonempty titles).
  2. There aren't any 'convenience' functions, like getting a list by name instead of ID (that being said, I'll likely get tired of repeating the same things myself, write a few, and bundle them in a separate helper module).

Installation

pip install wunderpy2

Usage & Examples

Getting a client

Wunderlist uses OAuth2 to allow applications to access users' data, so you'll need to create an application before doing anything. If you only want to access your own Wunderlist, generate an access token after creating your application and use it and the client ID as follows:

import wunderpy2
api = wunderpy2.WunderApi()
client = api.get_client(access_token, client_id)    # Fill in your values

If you want other Wunderlisters to use your application, you'll need to see the "Redirect users to request Wunderlist access" section of the authorization docs in order to get a temporary code when a user has authorized your app. Once you have the code, you only need one more step:

api = wunderpy2.WunderApi()
access_token = api.get_access_token(temporary_code, client_id, client_secret)   # Fill in your values here
client = api.get_client(access_token, client_id)    # Fill in your client ID

Wunderlist Objects

All Wunderlist objects are merely Python objects with special keys. For convenience, these keys are laid out in a class format in model.py. Note that not every object will have every key (e.g. List objects with type 'inbox' do not have creation metadata).

Examples

Creating a task with a due date, note, 'starred' flag, and subtask:

lists = client.get_lists()
list = lists[0]
task = client.create_task(1234, "My new task", due_date="2015-08-02", starred=True)
client.create_note(task[wunderpy2.Task.ID], "My note")
client.create_subtask(task[wunderpy2.Task.ID], "My subtask")

Shuffling the order of tasks within a list (see the Positions endpoint documentation):

import random
task_positions_obj = client.get_task_positions_obj(list[wunderpy2.List.ID])
ordering = task_positions_obj[wunderpy2.Task.VALUES]
random.shuffle(ordering)
client.update_task_positions_obj(task_positions_obj[wunderpy2.TaskPositionsObj.ID], task_positions_obj[wunderpy2.TaskPositionsObj.REVISION], ordering)

TODO

  • Endpoint implementation:
    • Avatar
    • File
    • File preview
    • Reminder
    • Task comment
    • Upload
    • User
    • Webhooks?

wunderpy2's People

Contributors

sandrobusonera avatar adamjlev avatar d0ugal avatar mieubrisse avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.