blueearth.py 文件源码

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

项目:blueearth 作者: littleningmeng 项目源码 文件源码
def get_latest_fragments(zoomlv=zoom_level):
    res = safe_urlopen(latest_json_url)
    jsonstr = res.read()  # like this: {"date":"2017-02-27 01:20:00","file":"PI_H08_20170227_0120_TRC_FLDK_R10_PGPFD.png"}   
    try:
        datadict = json.loads(jsonstr)
    except Exception as e:
        print "ERROR:\nbad response, maybe you are behind of firewall.\nplease test you network and retry."
        raw_input("anykey to quit")
        sys.exit(1)

    datestr = datadict.get("date", "")
    if datestr == "":
        print "bad date string"
        sys.exit(1)

    date, time = datestr.split(" ")#"2017-02-27 22:20:00".split(" ")#
    date, time = date.replace("-", "/"), time.replace(":", "")
    return get_fragments_by_date(date, time, zoomlv)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号