Skip to content

Instantly share code, notes, and snippets.

@slackorama
Created December 2, 2016 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slackorama/e4c24ddece39de3ad5ee60d6afc58c94 to your computer and use it in GitHub Desktop.
Save slackorama/e4c24ddece39de3ad5ee60d6afc58c94 to your computer and use it in GitHub Desktop.
pull a list from rtm and dump it in org
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