def add_follow_user(user_id, user_link, user_name): """ Adds a given user to the list of users to follow. """ feed = u.get_user_feed('user/follows.xml') tree = feed.xpath('/channel/items') element = E.item( E.user_id(user_id), E.user_name(user_name), E.user_link(user_link) ) tree.append(element) u.write_user_feed(feed, 'user/follows.xml')
def add_blocked_user(user_id, user_link, user_name): """ Adds a given user to the block list. """ feed = u.get_user_feed('user/blocks.xml') tree = feed.xpath('/channel/items') element = E.item( E.user_id(user_id), E.user_name(user_name), E.user_link(user_link) ) tree.append(element) u.write_user_feed(feed, 'user/blocks.xml')
def generate_new_feed(location='user/feed.xml'): """ Creates a blank XML feed and writes it. To fill in the information for the feed use the other helper methods provided. """ feed = E.channel( E.username(''), E.user_id(''), E.user_full_name(''), E.description(CDATA('')), E.link(''), E.blocks('', count=''), E.follows('', count=''), E.docs(''), E.language(''), E.lastBuildDate(''), E.reply_to( E.link(''), E.reply_to_user_id(''), E.reply_to_status_id(), E.reply_from_user_id(), E.reply_status_id(), E.user_link() ), ) u.write_user_feed(feed, location)