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
评论列表
文章目录