#!/usr/bin/env python # -*- coding: UTF-8 -*- import me2day class Expo: def __init__(self, id, api_key): me2day.init(id, api_key, 'xml') def get_posts(self): print '글을 가져와야 해요.' def write_post(self): print '글을 작성해야 해요.' def get_friends(self): print '친구 목록을 가져와야 해요.' def usage(self): print '=' * 8 print '1. 최근글 가져오기' print '2. 글 작성' print '3. 친구 보기' print '4. 그만 하기' print '=' * 8 methods = [ 'get_posts', 'write_post', 'get_friends' ] def start(self): while True: self.usage() try: cmd = int(raw_input('>> ')) except ValueError: continue if cmd == 4: break getattr(self, self.methods[cmd - 1])() id = raw_input('me2day id: ').strip() api_key = raw_input('me2day api_key: ').strip() console = Expo(id, api_key) console.start()