问题
I am new to python bottle framework and need to get $_SERVER['HTTP_USER_AGENT'] variable value specially. Pleas can some one explain how can I achieve this.
回答1:
Try it:
import request, route, run
@route('/user-agent')
def user_agent():
return request.environ.get('HTTP_USER_AGENT')
run()
来源:https://stackoverflow.com/questions/9400166/get-serverhttp-user-agent-variable-value-in-bottle