Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: e3a14ddb54
Fetching contributors…

Cannot retrieve contributors at this time

55 lines (45 sloc) 1.765 kB
#!/bin/env python
# -*- coding: utf-8 -*-
import rtm
import optparse
import ConfigParser
__author__ = 'Caio Romão <caioromao@gmail.com>'
__version__ = '0.1'
DESC = 'Remember The Milk Command Line Client'
USAGE = ''
def read_config(file="rtm.ini"):
config = ConfigParser.ConfigParser()
config.read(file)
sections = config.sections()
map = {}
for mach in sections:
for key,value in config.items(mach):
map[key] = value
return map
print read_config()
# TODO: Integrate with ConfigParser
# TODO: Make it more readable
p = optparse.OptionParser(description=DESC,version=__version__)
p.add_option('--api-key','-a',default='',metavar='key', help= 'The api key \
given to you when requested')
p.add_option('--shared-secret','-s',default='',metavar='secret', help='Your \
shared secret sent to you by mail from RTM upon request')
p.add_option('--token','-t',default='',metavar='tok',help='The application \
authorization token')
p.add_option('-c',action='store_true',dest='create_token', help='Requests \
online authorization and acquires a token.')
p.add_option('-g',action='store_true',dest='get_list',help='Fetches a TODO list')
p.add_option('--filter','-f',default='',help='Filters TODO list. e.g: "due:today"')
options,args = p.parse_args()
print 'API-KEY: %s' % options.api_key
print 'SHARED-SECRET: %s' % options.shared_secret
print 'TOKEN: %s' % options.token
if options.create_token:
print 'GETTING TOKEN'
api = rtm.Rtm(options.api_key, options.shared_secret)
elif options.get_list:
api = rtm.Rtm(options.api_key, options.shared_secret, options.token)
print 'FILTER: %s' % options.filter
list = api.get_list(options.filter)
for i in list:
print i
Jump to Line
Something went wrong with that request. Please try again.