data: {},
methods: {
get: function () {
axios({
method: 'post',
url: 'post.php',
data: {
a:'1'
}
}).then(function (response) {
alert(response.data)
})
.catch(function (error) {
alert(error)
})
}
}
})
Header可以通过Request提供的.add_header()方法进行添加,示例代码如下:
# -*- coding:utf-8 -*-import urllib2
import urllib
url = 'http://ah.example.com'
half_url = u'/servlet/av/jd?ai=782&ji=2624743&sn=I'
#构造get请求
req = urllib2.Request(url+half_url.encode('utf-8'))
#添加header
req.add_header('Accept-Encoding', 'gzip,deflate')
req.add_header('User-Agent','Mozilla/5.0')
response = urllib2.urlopen(req)
print response
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)