0

Basically I am trying to send a POST request with 2 files and 3 data in payload. Code snippet :

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())

It is throwing error :

ValueError: No Content-Length specified for iterable body

How to make it work?

mhawke
  • 84,695
  • 9
  • 117
  • 138
Meghna
  • 31
  • 2

0 Answers0