Python library for interacting with the Wunderlist 2 REST API

Overview

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
    • Folder
    • Reminder
    • Task comment
    • Upload
    • User
    • Webhooks?
Comments
  • Import errors

    Import errors

    >>> pip install wunderlist2
    
    >>> import wunderpy2
    Traceback (most recent call last):
      File "<string>", line 301, in runcode
      File "<interactive input>", line 1, in <module>
      File "C:\Anaconda3\lib\site-packages\wunderpy2\__init__.py", line 1, in <module>
        from wunderclient import WunderClient
    ImportError: No module named 'wunderclient'
    

    Is there an issue with the relative imports? Should it be

    from .wunderclient import WunderClient
    

    Or have I misunderstood something?

    I have really been looking forward to wunderpy2 :) Great stuff.

    opened by tobiasli 9
  • Rolling a new release

    Rolling a new release

    Hey,

    This look great. I see there are a number of fixes that have been merged into develop but are unreleased, this are particularly important for Python 3 support. I am looking at this: https://github.com/mieubrisse/wunderpy2/compare/0.1.4...develop

    Is there anything I can do to help roll a new release? I want to try wunderpy2 out and if it goes well with the develop version I will end up pushing a fork to PyPI so I can use it (named something obscure like wunderpy2-python3-fixes). However, I'd prefer to help with the canonical version if possible.

    opened by d0ugal 6
  • Client ID Syntax error

    Client ID Syntax error

    When I try to enter my credentials into the script, it keeps giving me a Syntax Error on my client ID. Here is my code.

    import wunderpy2
    
    access_token = MYCACCESSTOKEN
    client_id = **MYCLIENTID**              <----------------------- SYNTAX ERROR
    
    api = wunderpy2.WunderApi()
    client = api.get_client(access_token, **client_id**)    <--------  OR HERE, WITH VALUE BETWEEN BRACKETS
    
    lists = client.get_lists()
    print(lists)
    

    I have tried putting these values in between the api.get_client() brackets, I have tried converting them to strings. Correct me if I am wrong, but my client ID should be a 20-character alphanumeric string, right?

    opened by PieterJanSterk 3
  • .iteritems() doesn't exist on 3.x

    .iteritems() doesn't exist on 3.x

    Right now various things fail because dict.iteritems() is gone in Python 3. I'd recommend either adding six as a dependency for things like this, or simply bundling it (it's a single file).

    I can submit a PR if you tell me which you prefer (or alternately we can just add a file containing only an iteritems function that works on both...).

    opened by dwf 3
  • get_lists failes with invalid response

    get_lists failes with invalid response

    Hi there!

    I've fixed the relative imports, but have stumbled upon something else. I don't know if i've set things up correctly.

    I'm still running Python 3.4 on a clean windows machine. With a fresh client_id and access token from https://developer.wunderlist.com/apps.

    Trying to get lists, I consistently get an invalid response:

    import wunderpy2
    api = wunderpy2.WunderApi()
    client = api.get_client(access_token, client_id)
    client.get_lists()
    Traceback (most recent call last):
      File "<string>", line 293, in runcode
      File "<interactive input>", line 1, in <cmodule>
      File "D:\path\wunderpy2\wunderpy2\wunderclient.py", line 49, in get_lists
        return lists_endpoint.get_lists(self)
      File "D:\path\wunderpy2\wunderpy2\lists_endpoint.py", line 11, in get_lists
        response = client.authenticated_request(client.api.Endpoints.LISTS)
      File "D:\path\wunderpy2\wunderpy2\wunderclient.py", line 45, in authenticated_request
        return self.api.request(endpoint, method=method, headers=headers, params=params, data=data)
      File "D:\path\wunderpy2\wunderpy2\wunderapi.py", line 76, in request
        self._validate_response(method, response)
      File "D:\path\wunderpy2\wunderpy2\wunderapi.py", line 40, in _validate_response
        raise ValueError('{} {}'.format(response.status_code, str(response.json())))
    ValueError: 400 {'invalid_request': True}
    

    Debug stop shows no response from https://a.wunderlist.com/api/v1/lists.

    opened by tobiasli 3
  • ValueError: 409 {u'error': {u'message': u'There is a conflict with the given data.', u'type': u'conflict', u'revision_conflict': True, u'translation_key': u'api_error_conflict'}}

    ValueError: 409 {u'error': {u'message': u'There is a conflict with the given data.', u'type': u'conflict', u'revision_conflict': True, u'translation_key': u'api_error_conflict'}}

    It was working like a charm but today to delete an item and it gives this error. To add an item it works correctly, and to list them too.


    Traceback (most recent call last): File "menudinar.py", line 126, in deleteWunder() File "menudinar.py", line 99, in deleteWunder client.delete_task(task['id'],1) File "/usr/local/lib/python2.7/dist-packages/wunderpy2/wunderclient.py", line 89, in delete_task tasks_endpoint.delete_task(self, task_id, revision) File "/usr/local/lib/python2.7/dist-packages/wunderpy2/tasks_endpoint.py", line 91, in delete_task client.authenticated_request(endpoint, 'DELETE', params=params) File "/usr/local/lib/python2.7/dist-packages/wunderpy2/wunderclient.py", line 45, in authenticated_request return self.api.request(endpoint, method=method, headers=headers, params=params, data=data) File "/usr/local/lib/python2.7/dist-packages/wunderpy2/wunderapi.py", line 76, in request self._validate_response(method, response) File "/usr/local/lib/python2.7/dist-packages/wunderpy2/wunderapi.py", line 40, in _validate_response raise ValueError('{} {}'.format(response.status_code, str(response.json()))) ValueError: 409 {u'error': {u'message': u'There is a conflict with the given data.', u'type': u'conflict', u'revision_conflict': True, u'translation_key': u'api_error_conflict'}}

    It seems to be an authentication error?

    The command I am sending is: client.delete_task(task['id'],1)

    Thanks!

    Awesome app! :+1:

    opened by rogerillu 2
  • How to run tests?

    How to run tests?

    Hi,

    Sorry it's not really an issue but more asking you a question.

    I've forked this repo and have add the "folders" endpoint but I'm not sure how to config the "endpoint_tests" in the tests_config.yaml in order to run the tests. Could you guide me please?

    Thanks, Sandro

    opened by sandrobusonera 2
  • Folders endpoint

    Folders endpoint

    Hi,

    Here is the implementation of the folders endpoint. I've finally be able to run the tests thanks to your guidance but with commenting all the variables in the Config values for testing endpoints section from tests_config.py

    Could you please review and merge if you think all is good please?

    Thanks, Sandro

    opened by sandrobusonera 0
  • Using wunderpy2 in appdaemon

    Using wunderpy2 in appdaemon

    I am trying to get wunderpy2 working within the lovely AppDaemon (https://www.home-assistant.io/docs/ecosystem/appdaemon/)

    However, I am having trouble with the import, which seems to be very picky:

    Does not work:

    [10:39 rb@thor appdaemon] > /home/rb/appdaemon/bin/python3.5 test.py
    Traceback (most recent call last):
      File "test.py", line 1, in <module>
        import wunderpy2
    ImportError: No module named 'wunderpy2'
    

    Works fine:

    [10:39 rb@thor appdaemon] > /usr/bin/python3.5 test.py
    [10:39 rb@thor appdaemon] >
    

    It's just a symlink:

    [10:39 rb@thor appdaemon] > l /home/rb/appdaemon/bin/python3.5
    lrwxrwxrwx 1 rbrb18 Jul 22 10:33 /home/rb/appdaemon/bin/python3.5 -> /usr/bin/python3.5
    

    I believe this is why it will not load from within AppDaemon either.

    opened by joydashy 2
Owner
mieubrisse
mieubrisse
qualysclient - a python SDK for interacting with the Qualys API

qualysclient - a python SDK for interacting with the Qualys API

null 5 Oct 28, 2022
A python wrapper for interacting with the LabArchives API.

LabArchives API wrapper for Python A python wrapper for interacting with the LabArchives API. This very simple package makes it easier to make arbitra

Marek Cmero 3 Aug 1, 2022
Python 3 tools for interacting with Notion API

NotionDB Python 3 tools for interacting with Notion API: API client Relational database wrapper Installation pip install notiondb API client from noti

Viet Hoang 14 Nov 24, 2022
Python SDK for interacting with the Frame.io API.

python-frameio-client Frame.io Frame.io is a cloud-based collaboration hub that allows video professionals to share files, comment on clips real-time,

Frame.io 37 Dec 21, 2022
A simple library for interacting with Amazon S3.

BucketStore is a very simple Amazon S3 client, written in Python. It aims to be much more straight-forward to use than boto3, and specializes only in

Jacobi Petrucciani 219 Oct 3, 2022
A Python Library to interface with Flickr REST API, OAuth & JSON Responses

Python-Flickr Python-Flickr is A Python library to interface with Flickr REST API & OAuth Features Photo Uploading Retrieve user information Common Fl

Mike Helmick 40 Sep 25, 2021
A Python Library to interface with Tumblr v2 REST API & OAuth

Tumblpy Tumblpy is a Python library to help interface with Tumblr v2 REST API & OAuth Features Retrieve user information and blog information Common T

Mike Helmick 125 Jun 20, 2022
NiceHash Python Library and Command Line Rest API

NiceHash Python Library and Command Line Rest API Requirements / Modules pip install requests Required data and where to get it Following data is nee

Ashlin Darius Govindasamy 2 Jan 2, 2022
NiceHash Python Library and Command Line Rest API

NiceHash Python Library and Command Line Rest API Requirements / Modules pip install requests Required data and where to get it Following data is nee

Ashlin Darius Govindasamy 2 Jan 2, 2022
TM1py is a Python package that wraps the TM1 REST API in a simple to use library.

By wrapping the IBM Planning Analytics (TM1) REST API in a concise Python framework, TM1py facilitates Python developments for TM1. Interacting with T

Cubewise CODE 147 Dec 15, 2022
Python library wrapping and enhancing the Invenio RDM REST API.

Iridium The metal Iridium is used to refine and enhance metal alloys. Similarly, this package provides an enhanced coating around the Invenio RDM APIs

Materials Data Science and Informatics 2 Mar 29, 2022
A napari plugin for visualising and interacting with electron cryotomograms

napari-subboxer A napari plugin for visualising and interacting with electron cryotomograms. Installation You can install napari-subboxer via pip: pip

null 3 Nov 25, 2021
Example code for interacting with solana anchor programs - candymachine

candypy example code for interacting with solana anchor programs - candymachine THIS IS PURELY SAMPLE CODE TO FORK, MODIFY, UNDERSTAND AND INTERACT WI

dubbelosix 3 Sep 18, 2022
A client library for the REST API of DocuWare's DMS

docuware-client This is a client library for the REST API of DocuWare DMS. Since DocuWare's documentation regarding the REST API is very sparse (at th

Stefan Schönberger 1 Feb 23, 2022
A very simple Salesforce.com REST API client for Python

Simple Salesforce Simple Salesforce is a basic Salesforce.com REST API client built for Python 3.5, 3.6, 3.7 and 3.8. The goal is to provide a very lo

simple salesforce 1.4k Dec 29, 2022
📦 Opensource Python wrapper for Hiven's REST and WebSocket API

hiven.py ?? Opensource Python wrapper for Hiven's REST and WebSocket API Installation pip install -U hiven.py Usage hiven.py is currently under devel

Kevin Thomas 3 Sep 3, 2021
Python bindings for swm-core client REST API

Python bindings for swm-core client REST API Description Sky Port is an universal bus between user software and compute resources. It can also be cons

Sky Workflows 1 Jan 1, 2022
An unofficial Python wrapper for the 'Binance exchange REST API'

Welcome to binex_f v0.1.0 many interfaces are heavily used by myself in product environment, the websocket is reliable (re)connected. Latest version:

DeepLn 2 Jan 5, 2022
pyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Master Server

PyDuinoCoin PyDuinoCoin is a simple python integration for the DuinoCoin REST API, that allows developers to communicate with DuinoCoin Main Server. I

BackrndSource 6 Jul 14, 2022