'''
 Inquire all channel authentication records.
 MQWeb runs on localhost and is listening on port 8081. 
'''
import sys
import json
import httplib
import socket

if len(sys.argv) < 2 :
	print 'Please pass me the name of a queuemanager as argument'
	sys.exit(1)

url = '/api/chlauth/inquire/' + sys.argv[1]

try:
	conn = httplib.HTTPConnection('localhost', 8081)
	conn.request('GET', url)
	res = conn.getresponse()
	result = json.loads(res.read())

	if 'error' in result:
		print ('Received a WebSphere MQ error: ' +	
			str(result['error']['reason']['code'])
		)
	else:
		if len(result['data']) == 0:
			print "No channels found"
		else:
			for data in result['data']:
				print data
except httplib.HTTPException as e:
	print ('An HTTP error occurred while inquiring channels: ' +
		e.errno + e.strerror
	)
except socket.error as e:
	print e.strerror
	print 'Is the MQWeb daemon running?'

@@ -159,68 +159,253 @@
 ket%0A
-%0Aif len(sys.argv) %3C 2 :%0A%09print 'Please pass me the n
+import argparse%0A%0Aparser = argparse.ArgumentParser(%0A%09description='MQWeb - Python sample - Inquire Channel Authentication Record',%0A%09epilog=%22For more information: http://www.mqweb.org%22%0A)%0Aparser.add_argument('-m', '--queuemanager', help='N
 ame of 
-a
+the
  que
@@ -417,33 +417,134 @@
 ager
- as argument'%0A%09sys.exit(1
+', required=True)%0Aparser.add_argument('-p', '--profile', help='Name of the channel', required=False)%0Aargs = parser.parse_args(
 )%0A%0Au
@@ -578,19 +578,25 @@
 ' + 
-sys.argv%5B1%5D
+args.queuemanager
 %0A%0Atr

Use argparse