Python 如何确定瓶子服务器是否已成功启动?

Python 如何确定瓶子服务器是否已成功启动?,python,bottle,Python,Bottle,它是瓶子web服务器的一个典型的最小示例 from bottle import route, run, template @route('/hello/<name>') def index(name): return template('<b>Hello {{name}}</b>!', name=name) run(host='localhost', port=8080) 从瓶子导入路线、运行、模板 @路由(“/hello/”) def索引(名称

它是
瓶子
web服务器的一个典型的最小示例

from bottle import route, run, template

@route('/hello/<name>')
def index(name):
    return template('<b>Hello {{name}}</b>!', name=name)

run(host='localhost', port=8080)
从瓶子导入路线、运行、模板
@路由(“/hello/”)
def索引(名称):
返回模板('Hello{{name}}!',name=name)
运行(host='localhost',port=8080)

如何确定
run
是否已成功启动
瓶子
服务器的实例,并且服务器已准备好接收传入的http呼叫?

使用web浏览器,尝试浏览到
http://localhost:8080/hello/Anthony
。如果您在linux上,请尝试
wgethttp://localhost:8080/hello/Anthony

我想你可以连接
httplib
(或者
http.client
,如果你有python3的话),但我从来都不需要它。