def PostEntities(host_port, uri, cookie, kind, content):
 logging.debug('Connecting to %s', host_port)
 try:
  body = urllib.urlencode({constants.KIND_PARAM: kind, constants.CSV_PARAM: content})
  headers = {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': len(body), 'Cookie': cookie}
  logging.debug('Posting %d bytes to http://%s%s', len(body), host_port, uri)
  connection = httplib.HTTPConnection(host_port)
  try:
   connection.request('POST', uri, body, headers)
   response = connection.getresponse()
   status = response.status
   reason = response.reason
   content = response.read()
   logging.debug('Received response code %d: %s', status, reason)
   if (status != httplib.OK):
    raise BadServerStatusError(('Received code %d: %s\n%s' % (status, reason, content)))
  finally:
   connection.close()
 except (IOError, httplib.HTTPException, socket.error) as e:
  logging.debug('Encountered exception accessing HTTP server: %s', e)
  raise PostError(e)

def PostEntities ( host_port , uri , cookie , kind , content ) : logging . debug ( 'Connecting to %s' , host_port ) try : body = urllib . urlencode ( { constants . KIND_PARAM : kind , constants . CSV_PARAM : content } ) headers = { 'Content-Type' : 'application/x-www-form-urlencoded' , 'Content-Length' : len ( body ) , 'Cookie' : cookie } logging . debug ( 'Posting %d bytes to http://%s%s' , len ( body ) , host_port , uri ) connection = httplib . HTTPConnection ( host_port ) try : connection . request ( 'POST' , uri , body , headers ) response = connection . getresponse ( ) status = response . status reason = response . reason content = response . read ( ) logging . debug ( 'Received response code %d: %s' , status , reason ) if ( status != httplib . OK ) : raise BadServerStatusError ( ( 'Received code %d: %s\n%s' % ( status , reason , content ) ) ) finally : connection . close ( ) except ( IOError , httplib . HTTPException , socket . error ) as e : logging . debug ( 'Encountered exception accessing HTTP server: %s' , e ) raise PostError ( e )
posts entity records to a remote endpoint over http .