python发送http请求
#coding=utf-8
import urllib2
import json
body = {
"id":123456,
"index":"indexName"
}
url = "http://www.baidu.com"
head = {
"Content-Type":"application/json"
}
# 发送post请求
request = urllib2.Request(url,json.dumps(body),head)
# 发送get请求
# request.
原创
2021-09-14 21:57:43 ·
183 阅读 ·
0 评论