def main_with_options(options, files):
    '''
    Main function the prints twitter's _POST_ACTIONS to stdout

    TODO: look at possibly dividing up this function
    '''

    apifile = _open('http://apiwiki.twitter.com/REST+API+Documentation')
    try:
        apihtml = uni2html(apifile.read())
    finally:
        apifile.close()

    ## Parsing the ApiWiki Page

    apidoc = BeautifulSoup(apihtml)
    toc = apidoc.find('div', {'class':'toc'})
    toc_entries = toc.findAll('li', text=lambda text: 'Methods' in text)
    method_links = {}
    for entry in toc_entries:
        links = entry.parent.parent.findAll('a')
        method_links[links[0].string] = [x['href'] for x in links[1:]]

    # Create unique hash of mehods with POST_ACTIONS
    POST_ACTION_HASH = {}
    for method_type, methods in method_links.items():
        for method in methods:
            # Strip the hash (#) mark from the method id/name
            method = method[1:]
            method_body = apidoc.find('a', {'name': method})
            value = list(method_body.findNext(
                    'b', text=lambda text: 'Method' in text
                ).parent.parent.childGenerator())[-1]
            if 'POST' in value:
                method_name = method_body.findNext('h3').string
                try:
                    POST_ACTION_HASH[method_name] += (method_type,)
                except KeyError:
                    POST_ACTION_HASH[method_name] = (method_type,)

    # Reverse the POST_ACTION_HASH
    # this is done to allow generation of nice comment strings
    POST_ACTION_HASH_R = {}
    for method, method_types in POST_ACTION_HASH.items():
        try:
            POST_ACTION_HASH_R[method_types].append(method)
        except KeyError:
            POST_ACTION_HASH_R[method_types] = [method]

    ## Print the POST_ACTIONS to stdout as a Python List
    print """'''
    This module is automatically generated using `update.py`

    .. data:: POST_ACTIONS
        List of twitter method names that require the use of POST
'''
"""
    print 'POST_ACTIONS = [\n'
    for method_types, methods in POST_ACTION_HASH_R.items():
        print_fw(method_types, prefix='# ', indent=1)
        print_fw([repr(str(x)) for x in methods], indent=1, trail=True)
        print ""
    print ']'
dataset/ETHPy150Open sixohsix/twitter/utils/update.py/main_with_options/original