python使用urllib2通过htt

2023-01-31 03:01:07 python urllib2 htt
# -*- coding: utf-8 -*-
import urllib2


# Http发送报文
def httpsend(url, bw):
    req = urllib2.Request(url, bw)
    res_data = urllib2.urlopen(req)
    res = res_data.read()
    print(res)  # 打出响应信息


if __name__ == "__main__":
    url = "http://20.0.1.157:30043/OMP"
    bw = '请求报文'
    httpsend(url, bw)






相关文章