python写post请求

import httplib
import json
import time

postdata = {"orderId": "",
            "humanResult": 319,
            "operator": "sssss",
            "remark": "gis pass"}

orderIds = "12312,123123"
orderList = orderIds.split(',')
print(orderList)

conn = httplib.HTTPConnection("uc.qcs.sankuai.com")
requrl = "http:/xxxx"(这个是请求的地址)
headerdata = {"Content-type": "application/json"}

for orderId in orderList:
    time.sleep(1)
    print orderId
    postdata['orderId'] = orderId
    conn.request('POST', requrl, json.dumps(postdata), headerdata)

    response = conn.getresponse()

    res = response.read()

    print res
 

你可能感兴趣的:(python)