DeviceScanner.py 文件源码

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

项目:wpw-sdk-python 作者: WPTechInnovation 项目源码 文件源码
def output_json(svc_msg, service_types):
    """
    Writes output results to a file
    """
    global DATA2
    outfname = 'device-scanner.json'
    DATA2 = DATA2 + [{'serverid': svc_msg.getServerId(),
                      'devicename': svc_msg.getDeviceName(),
                      'devicedescription': svc_msg.getDeviceDescription(),
                      'hostname': svc_msg.getHostname(),
                      'portnumber': svc_msg.getPortNumber(),
                      'urlprefix': svc_msg.getUrlPrefix(),
                      'servicetypes': service_types,
                      }]
    try:
        with open(outfname, 'w') as outfile:
            json.dump(DATA2, outfile)
    except Exception:
        print("You need to configure the webserver path" +
              " if you want to output json")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号