Wiki

Clone wiki

pyrtm / Home

Welcome

pyrtm documentation

To the best of my knowledge there is no substantial documentation for pyrtm. Although its pretty simple, it took me a little while to figure out how to use the library, so I'll offer some starting hints. I've been developing on Ubuntu linux, but hopefully (almost) everything I write will apply the the majority of environments.

Installing

  1. Get an API key for Remember The Milk. This is pretty easy and they email it to you immediately. See RTM API keys
  2. Install the dependencies. The only mandatory one I discovered was the 'simplejson' module. In ubuntu, this is satisfied by the 'python-simplejson' package.
  3. An optional dependency for running the demo application, which you probably already have, is tk. In ubuntu the package name is 'python-tk'
  4. As root, run
# python setup.py install

Or you can install with buildout

$ hg clone https://your_account@bitbucket.org/srid/pyrtm ./pyrtm
$ cd pyrtm
$ python bootstrap.py -d
$ bin/buildout

Testing

  • At this point you should be able to run
$ rtm_appsample <APIKEY> <SHARED_SECRET> [TOKEN]

when you first run the program you will need to give your program access via a webpage -- the instructions are all printed to standard out.

Example API Calls

Looking at app.py gives the structure needed to get started. To make an API call you need an RTM object, which I call 'my_rtm', returned from the createRTM function. You can call any method by treating it as a member of 'my_rtm'. For example, to add a task called "Buy some milk." with priority 2, the following code suffices:

import rtm
my_rtm = rtm.createRTM(APIKEY, SHARED_SECRET, TOKEN)
time = my_rtm.timelines.create();
my_rtm.tasks.add(timeline=time.timeline, name="Buy some milk. !2", parse=1);

All the arguments to these functions are described by the Remember The Milk API Documentation. The RTM documentation is authoritative and has all the information you really need. You will observe that this documentation requires to provide the API key with each call, but the RTM object that's been created takes care of this for us.

Notice that the return value for any API call is of a special type defined in rtm.py called dottedDict. This is just like a normal dictionary except you access the keys as members. The 'time' variable above is an example of a dictionary like this, and time.timeline is its timeline member. You need a timeline object to pass to most API functions, and it can always be created in the above manner. You can reuse the timeline if you would like. Read more on this here.

You can also find a list of all the functions supported by pyrtm in the rtm.py file in the large structure called API. If for some reason the API provided by Remember The Milk changes, the only required change for pyrtm is to modify this data structure. Good luck!

Information about the Wiki

Wiki features

This wiki uses the Creole syntax, and is fully compatible with the 1.0 specification.

The wiki itself is actually a hg repository, which means you can clone it, edit it locally/offline, add images or any other file type, and push it back to us. It will be live immediately.

Go ahead and try:

$ hg clone http://bitbucket.org/srid/pyrtm/wiki/

Wiki pages are normal files, with the .wiki extension. You can edit them locally, as well as creating new ones.

Syntax highlighting

You can also highlight snippets of text, we use the excellent Pygments library.

Here's an example of some Python code:

def wiki_rocks(text):
	formatter = lambda t: "funky"+t
	return formatter(text)

You can check out the source of this page to see how that's done, and make sure to bookmark the vast library of Pygment lexers, we accept the 'short name' or the 'mimetype' of anything in there.

Have fun!

Updated