Python 官方文档:入门教程 => 点击学习
通过发送Http OPTioNS请求,可以获取 http允许的方法(我这里主要测试网站是否开启WEBDav),测试如下: import urllib2 import JSON import httplib url='192.168.14
通过发送Http OPTioNS请求,可以获取 http允许的方法(我这里主要测试网站是否开启WEBDav),测试如下:
import urllib2
import JSON
import httplib
url='192.168.149.131'
def http_get():
conn = httplib.HTTPConnection(url)
conn.request("GET", "/iisstart.htm")
ret = conn.getresponse()
response = ret.read()
return response
def http_options():
conn = httplib.HTTPConnection(url)
conn.request("OPTIONS", "/")
ret = conn.getresponse()
print ret.msg.dict
print ret.msg.dict['allow']
ret = http_options()
#ret2 = http_get()
#print ret
E:\>python isWebDav.py
{'content-length': '0', 'accept-ranges': 'none', 'ms-author-via': 'DAV', 'server': 'Microsoft-IIS/6.0', 'dav': '1, 2', 'dasl': '<DAV:sql>', 'allow': 'OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK', 'cache-control': 'private', 'date': 'Wed, 29 Mar 2017 15:59:20 GMT', 'public': 'OPTIONS, TRACE, GET, HEAD, DELETE, PUT, POST, COPY, MOVE, MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, SEARCH'}
OPTIONS, TRACE, GET, HEAD, COPY, PROPFIND, SEARCH, LOCK, UNLOCK
--结束END--
本文标题: python http OPTIONS请
本文链接: https://www.lsjlt.com/news/187570.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0