@@ -0,0 +1,1890 @@
+#!/usr/bin/env python%0A# encoding: utf-8%0A%22%22%22%0A    instapaper.com cli client%0A%22%22%22%0A%0Aimport urllib%0Aimport urllib2%0Aimport re%0Aimport sys%0Aimport os%0Aimport instapaperlib%0Afrom optparse import OptionParser%0Afrom getpass import getpass%0A%0Adef main():%0A    %22%22%22%0A        main method%0A    %22%22%22%0A    # initialize parser%0A    usage = %22usage: %25prog %5B-u USER%5D %5B-p PASSWORD%5D %5B-t TITLE%5D url%22%0A    parser = OptionParser(usage, version=%22%25prog %22+instapaperlib.__version__)%0A    parser.add_option(%22-u%22, %22--user%22, action=%22store%22, dest=%22user%22,%0A                      metavar=%22USER%22, help=%22instapaper username%22)%0A    parser.add_option(%22-p%22, %22--password%22, action=%22store%22, dest=%22password%22,%0A                      metavar=%22USER%22, help=%22instapaper password%22)%0A    parser.add_option(%22-t%22, %22--title%22, action=%22store%22, dest=%22title%22,%0A                      metavar=%22TITLE%22, help=%22title of the link to add%22)%0A%0A    (options, args) = parser.parse_args()%0A%0A    if not options.title:%0A        title = %22%22%0A    else:%0A        title = options.title%0A    if not len(args) %3E 0:%0A        parser.error(%22What do you want to read later?%22)%0A%0A    if not options.user:%0A        # auth regex%0A        login = re.compile(%22(.+?):(.+)%22)%0A        try:%0A            config = open(os.path.expanduser(%22~%22) + %22/.instapaperrc%22)%0A            for line in config:%0A                matches = login.match(line)%0A                if matches:%0A                    user = matches.group(1).strip()%0A                    password = matches.group(2).strip()%0A        except IOError:%0A            parser.error(%22No login information present.%22)%0A            sys.exit(-1)%0A    else:%0A        user = options.user%0A        # make sure all parameters are present%0A        if not options.password:%0A            password = getpass()%0A        else:%0A            password = options.password%0A%0A    (status, text) = instapaperlib.add_item(user, password, args%5B0%5D, title)%0A    print text%0A%0Aif __name__ == %22__main__%22:%0A    main()%0A

add command line client