-----------------------------------
<type 'tuple'>
(0, '3133310008_1 xe5xbdx93xe5x89x8dxe9x98x9fxe5x88x97xe6xb7xb1xe5xbaxa6xe4xb8xba==0
MsgSeqNumber====1
xe7xacxacxe4xb8x80xe6x9dxa1xe6xb6x88xe6x81xafxe5x86x85xe5xaexb9==')
-----------------------------------
2018-01-16-05:32:29
[16/Jan/2018 05:32:29] "GET /api/readmqmessage/?env=3133310008_1&app=%E7%94%B5%E7%A5%A8%E7%B3%BB%E7%BB%9F&qmgr=QMEMBFE&queue=3133310008_1 HTTP/1.1" 200 130
aaaaaaaaaaaaaaaa
Performing system checks...
System check identified no issues (0 silenced).
January 16, 2018 - 05:34:12
Django version 1.11, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:9000/
Quit the server with CONTROL-C.
/api/readmqmessage/?env=ERRMSG&app=%E7%94%B5%E7%A5%A8%E7%B3%BB%E7%BB%9F&qmgr=QMEMBFE&queue=ERRMSG
ERRMSG
-----------------------------------
<type 'tuple'>
(0, 'ERRMSG 当前队列深度为==0
MsgSeqNumber====1
第一条消息内容==')
-----------------------------------
def readmqmessage(req):
print req.get_full_path()
print req.GET['queue']
qname=req.GET['queue']
output=commands.getstatusoutput("/home/mqm/sbin/read_mq_message QMEMBFE 'SYSTEM.ADMIN.SVRCONN' '10.3.244.1' '1417' %s" % qname)
print '-----------------------------------'
print type(output)
aa=str(output)
print aa.decode('string_escape')
bb=aa.decode('string_escape')
print '-----------------------------------'
stime=(datetime.datetime.now().strftime('%Y-%m-%d-%H:%M:%S'))
print stime
filename='/home/mqm/package/'+qname+stime+'.txt'
file_obj=open(filename,'w')
file_obj.write(bb)
file_obj.close()
return HttpResponse(json.dumps(output), content_type="application/json")
需要做aa.decode('string_escape')