# Path: common/common_html.py
# def get_head(title, css = None, html5 = False):
# 
# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):
# 
# Path: common/utils.py
# def read_file(filename):
# def write_file(filename, text):
# def save_obj(filename, data):
# def load_obj(filename):
# def sha1(filename):
# def write_sha1(sha1, filename):
# def url_opener():
# def copy_file_from_url(url, out_file, expect_sha1 = None, max_retry = 4):
# def compress_file_data(out_filename, data, compress_type):
# def compress_file(out_filename, in_filename, compress_type):
# def uncompress_file(filename, compress_type):
# def _retry_on_eintr(func, *args):
# def safe_read(fd):
# def safe_write(fd, text):
# def print_traceback(*kwargs):
# def readline_backward(filename, buf_size=8192):


import os
import sys
import ws_category
import types
import json
    import cgi
from common import common_html
from common import db
from common import utils
    from flup.server.cgi import WSGIServer
        except:
            utils.print_traceback()
            ret_code = '500 Internal Server Error'
            text = '<h1>' + ret_code + '</h1>'
    else:
        ret_code = '400 Bad Request'
        text = '<h1>' + ret_code + '</h1>'

    text += '  </body>\n</html>'

    return return_response(start_response, text.encode('utf-8'), False, ret_code, 'text/html')

def myapp(environ, start_response):
    params = query_params(environ)

    print >> sys.stderr, params

    if params['cmd'] == 'ping':
        return handle_ping(start_response)
    elif params['cmd'] == 'scan':
        return handle_scan_query(params, start_response)
    else:
        return handle_status(params, start_response)

if __name__ == "__main__":
    sys.stderr = open(os.path.expanduser('~/log/pages_without_scan.err'), 'a')

    try:
        WSGIServer(myapp).run()
    except BaseException:

# Path: common/common_html.py
# def get_head(title, css = None, html5 = False):
# 
# Path: common/db.py
# def user_db_prefix():
# def database_name(domain, family):
# def use_db(conn, domain, family, cursor_class = None):
# def create_conn(**kwargs):
#     def __init__(self, db_name):
#     def open(self):
#     def close(self):
# def connection(db_obj):
# class UserDb(object):
# 
# Path: common/utils.py
# def read_file(filename):
# def write_file(filename, text):
# def save_obj(filename, data):
# def load_obj(filename):
# def sha1(filename):
# def write_sha1(sha1, filename):
# def url_opener():
# def copy_file_from_url(url, out_file, expect_sha1 = None, max_retry = 4):
# def compress_file_data(out_filename, data, compress_type):
# def compress_file(out_filename, in_filename, compress_type):
# def uncompress_file(filename, compress_type):
# def _retry_on_eintr(func, *args):
# def safe_read(fd):
# def safe_write(fd, text):
# def print_traceback(*kwargs):
# def readline_backward(filename, buf_size=8192):


# Path: pages_without_scan/pages_without_scan.py
import os
import sys
import ws_category
import types
import json
    import cgi
from common import common_html
from common import db
from common import utils
    from flup.server.cgi import WSGIServer

        except:
            utils.print_traceback()
            ret_code = '500 Internal Server Error'
            text = '<h1>' + ret_code + '</h1>'
    else:
        ret_code = '400 Bad Request'
        text = '<h1>' + ret_code + '</h1>'

    text += '  </body>\n</html>'

    return return_response(start_response, text.encode('utf-8'), False, ret_code, 'text/html')

def myapp(environ, start_response):
    params = query_params(environ)

    print >> sys.stderr, params

    if params['cmd'] == 'ping':
        return handle_ping(start_response)
    elif params['cmd'] == 'scan':
        return handle_scan_query(params, start_response)
    else:
        return handle_status(params, start_response)

if __name__ == "__main__":
    sys.stderr = open(os.path.expanduser('~/log/pages_without_scan.err'), 'a')

    try:
        WSGIServer(myapp).run()
    except BaseException:

        utils.print_traceback()