create_webserver.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:scitokens 作者: scitokens 项目源码 文件源码
def start_server(test_n, test_e, test_id):
    """
    Man this is ugly.  But you have to set global variables because it's
    impossible to send arguments to the HTTPServer, since you pass the HTTPServer
    as a type, not an instance.

    :param long int test_n: N for an RSA key
    :param long int test_e: E for an RSA key
    :param str test_id: Key ID for the test key
    """
    global TEST_N
    global TEST_E
    global TEST_ID
    global THREAD
    global HTTPD

    TEST_N = test_n
    TEST_E = test_e
    TEST_ID = test_id

    server_address = ('127.0.0.1', 0)
    HTTPD = HTTPServer(server_address, OauthRequestHandler)
    THREAD = threading.Thread(target=HTTPD.serve_forever)
    THREAD.daemon = True
    THREAD.start()
    return HTTPD.server_address
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号