基本上我正在尝试发送一个带有2个文件和3个数据的POST请求。 代码段:
bs_url = atmos_config.connectURL+":"+atmos_config.ds_api_port+atmos_config.bs_api_path
items = []
items.append(MultipartParam('fullyQualifiedDockerImageUrl',dockerImageUrl))
items.append(MultipartParam('appID',appID))
items.append(MultipartParam.from_file('manifest.json',atmos_config.app_manifest_path))
items.append(MultipartParam.from_file('petstoreapplication_2.0.0.ear', atmos_config.app_ear_path))
datagen, headers = multipart_encode(items)
headers1 = {'Content-Type': 'multipart/form-data; boundary=buildServerBoundary', 'cookie': atmos_config.cookie, 'X-Atmosphere-Remote-User': atmos_config.x_atmosphere_remote_user}
response_bs = urllib2.Request(bs_url+"builds", datagen, headers1)
logger.log("Response [Build-Server]: %s" %urllib2.urlopen(response_bs).read())
抛出错误:
ValueError: No Content-Length specified for iterable body
如何让它发挥作用?