|
156 |
print ' ARGUMENTS: %s' % pprint.pformat( msg.arguments ) |
156 |
print ' ARGUMENTS: %s' % pprint.pformat( msg.arguments ) |
157 |
else: |
157 |
else: |
158 |
print ' ARGUMENTS: %s' % ' '.join( msg.arguments ) |
158 |
print ' ARGUMENTS: %s' % ' '.join( msg.arguments ) |
159 |
print ' STATUS : %d' % msg.status |
159 |
print 'MIMETYPE : %s' % msg.mimetype |
160 |
if msg.options: |
160 |
if msg.mimetype == umcp.MIMETYPE_JSON: |
|
|
161 |
print ' STATUS : %d' % msg.status |
162 |
if msg.options: |
163 |
if self._options.prettyprint: |
164 |
print ' OPTIONS : %s' % pprint.pformat( msg.options, indent = 2 ) |
165 |
else: |
166 |
if isinstance( msg.options, ( list, tuple ) ): |
167 |
print ' OPTIONS : %s' % ', '.join( map( lambda x: str( x ), msg.options ) ) |
168 |
else: |
169 |
print ' OPTIONS : %s' % ' '.join( [ '%s=%s' % ( k, v ) for k, v in msg.options.items() ] ) |
170 |
print ' MESSAGE : %s' % msg.message |
161 |
if self._options.prettyprint: |
171 |
if self._options.prettyprint: |
162 |
print ' OPTIONS : %s' % pprint.pformat( msg.options, indent = 2 ) |
172 |
print ' RESULT : %s' % pprint.pformat( msg.result, indent = 2 ) |
163 |
else: |
173 |
else: |
164 |
if isinstance( msg.options, ( list, tuple ) ): |
174 |
print ' RESULT : %s' % msg.result |
165 |
print ' OPTIONS : %s' % ', '.join( map( lambda x: str( x ), msg.options ) ) |
175 |
if msg.status is not None: |
166 |
else: |
176 |
raise ClientExit( msg.status - 200 ) |
167 |
print ' OPTIONS : %s' % ' '.join( [ '%s=%s' % ( k, v ) for k, v in msg.options.items() ] ) |
|
|
168 |
print ' MESSAGE : %s' % msg.message |
169 |
if self._options.prettyprint: |
170 |
print ' RESULT : %s' % pprint.pformat( msg.result, indent = 2 ) |
171 |
else: |
177 |
else: |
172 |
print ' RESULT : %s' % msg.result |
178 |
print 'BODY : %s' % str( msg.body ) |
173 |
raise ClientExit( msg.status - 200 ) |
179 |
raise ClientExit() |
174 |
|
180 |
|
175 |
if __name__ == '__main__': |
181 |
if __name__ == '__main__': |
176 |
notifier.init( notifier.GENERIC ) |
182 |
notifier.init( notifier.GENERIC ) |
|
255 |
try: |
261 |
try: |
256 |
notifier.loop() |
262 |
notifier.loop() |
257 |
except ClientExit, exit: |
263 |
except ClientExit, exit: |
258 |
exitcode = int( exit.args[ 0 ] ) |
264 |
if exit.args: |
259 |
if exitcode == 200: |
265 |
exitcode = int( exit.args[ 0 ] ) |
260 |
exitcode = 0 |
266 |
if exitcode == 200: |
261 |
sys.exit( exitcode ) |
267 |
exitcode = 0 |
|
|
268 |
sys.exit( exitcode ) |
269 |
sys.exit( 0 ) |
262 |
|
270 |
|