Created
December 2, 2016 21:35
-
-
Save slackorama/e4c24ddece39de3ad5ee60d6afc58c94 to your computer and use it in GitHub Desktop.
pull a list from rtm and dump it in org
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rtm | |
token = '' # get this somewhere else | |
# this is the token and secret from the rtm-cli app so I assume putting it here is ok | |
milk = rtm.createRTM('cbc76268b901ccb8d9fc5f3aebc4ee1f', | |
'131beea786379309', | |
token | |
) | |
tasks = milk.tasks.getList(filter='list:books status:incomplete') | |
tasks = tasks.tasks.list[0].taskseries | |
for task in sorted(tasks, key=lambda x: x.name.replace('The','').strip()): | |
if hasattr(task.tags, 'tag'): | |
tags = task.tags.tag | |
if isinstance(tags, list): | |
tags = ':{0}:'.format(':'.join(tags)) | |
else: | |
tags = ':{0}:'.format(tags) | |
else: | |
tags = '' | |
url = task.url or None | |
title = task.name.strip().replace('[','{').replace(']','}') | |
if url: | |
print('* [[{0}][{1}]] {2}'.format(url, title, tags)) | |
else: | |
print('* {0} {1}'.format(title, tags)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment