如何使用python从瓶子服务器获取dict值

时间:2017-05-23 12:28:12

标签: python http bottle

我写了这个服务器代码:

from bottle import run, route, get, post, request, template
import json
import socket
import os
import time


@route('/')
@route('/RegisterMessage/<message_type>', method='GET')
def reg_msg_type(message_type):
    print "Suscribe to", message_type, 'messages'
    if message_type == 'time':
        time = dict()
        time['utc_time'] = 123456
        time['time_zone'] = -120
        return time

#configuring host, port.
run(host='192.168.0.119', port=8088, debug=True)

当我在浏览器中转到http://192.168.0.119:8088/RegisterMessage/time时,我得到了回复:

{"time_zone": -120, "utc_time":123456}

现在我想在python中编写一个客户端,它将从我的服务器中检索这些值。我无法在瓶子的文档中找到与此相关的任何内容。

0 个答案:

没有答案