def __prepareResponse(resp): try: serializedResp = dynamicserialize.serialize(resp) except: resp = ErrorResponse() errorMsg = 'Error serializing response: ' + IDataStore._exc() logger.error(errorMsg) resp.setError(errorMsg) # hopefully the error response serializes ok, if not you're kind of screwed serializedResp = dynamicserialize.serialize(resp) return Response(serializedResp)
def main(): request = DatasetDataRequest() request.setFilename("/common/njensen/awips/edex/data/hdf5/obs/2010/09/15/11/metar.h5") request.setDatasetGroupPath(['presWeather', 'windGust', 'visibility', 'seaLevelPress', 'tempFromTenths', 'pressChange3Hour', 'rawMETAR', 'pressChangeChar', 'temperature', 'dpFromTenths', 'windSpeed', 'skyCover', 'dewpoint', 'longitude', 'latitude', 'windDir']) req = Request() req.setType('YLINE') req.setIndices([4,14]) request.setRequest(req) ds = H5pyDataStore.H5pyDataStore() result = ds.retrieveDatasets(request) print "result", result obj = dynamicserialize.serialize(result) f = open('/tmp/pyLight', 'w') f.write(obj) f.close()
def writeObject(): data = PointTest() p1 = Point() p1.setX(26) p1.setY(9) p2 = Point() p2.setX(144) p2.setY(-7) points = [p1, p2] data.setPoints(points) bytes = dynamicserialize.serialize(data) f = open('/tmp/pythonPoints', 'w') f.write(bytes) f.close() print "wrote to /tmp/pythonPoints"
def main(): req = RetrieveRequest() req.setIncludeInterpolated(False) req.setGroup('/bufrua') req.setFilename('/home/njensen/temp/corruptHdf5/bufrua-2010-10-07-18.h5') message = dynamicserialize.serialize(req) httpConn = httplib.HTTPConnection("localhost", 9582, timeout=90) httpConn.connect() httpConn.request("POST", '/', message) response = httpConn.getresponse() if (response.status != 200): print response, response.status, response.msg print dir(response) raise RuntimeError("Unable to post request to server") rval = dynamicserialize.deserialize(response.read()) httpConn.close() print rval.getError()
import dynamicserialize.dstypes.com.raytheon.uf.common.bmh.notify.config.LanguageDictionaryConfigNotification as ConfigNotification import sys import dynamicserialize from qpid.messaging import * if len(sys.argv) < 2: broker = "localhost:5672" else: broker = sys.argv[1] connection = Connection(broker) connection.open() session = connection.session() sender = session.sender("amq.topic/BMH.Config") #configNotification = ConfigNotification.LanguageDictionaryConfigNotification() configNotification = ConfigNotification() configNotification.setNational(True) configNotification.setLanguage('ENGLISH') configNotification.setType('Update') updatedWords = [ 'winds', 'record', 'lead', 'objects' ] configNotification.setUpdatedWords(updatedWords) sender.send(Message(dynamicserialize.serialize(configNotification))) connection.close()