Skip to content

Commit 278b278

Browse files
author
Wasin Waeosri
committed
Change logs:
1. Update license information 2. Add new log code
1 parent 37343cf commit 278b278

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

mrn_prototype.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# | This source code is provided under the Apache 2.0 license --
33
# | and is provided AS IS with no warranty or guarantee of fit for purpose. --
44
# | See the project's LICENSE.md for details. --
5-
# | Copyright Thomson Reuters 2017. All rights reserved. --
5+
# | Copyright Refinitiv 2019. All rights reserved. --
66
# |-----------------------------------------------------------------------------
77

88

@@ -21,7 +21,7 @@
2121
import zlib
2222

2323
# Global Default Variables
24-
hostname = '172.20.33.30'
24+
hostname = '127.0.0.1'
2525
port = '15000'
2626
user = 'root'
2727
app_id = '256'
@@ -66,7 +66,7 @@ def processRefresh(ws, message_json):
6666

6767

6868
def processMRNUpdate(ws, message_json): # process incoming News Update messages
69-
print("RECEIVED: Update Message")
69+
#print("RECEIVED: Update Message")
7070
# print(message_json)
7171

7272
fields_data = message_json["Fields"]
@@ -135,15 +135,18 @@ def processMRNUpdate(ws, message_json): # process incoming News Update messages
135135

136136
# News Fragment(s) completed, decompress and print data as JSON to console
137137
if tot_size == len(fragment):
138+
print("decompress News FRAGMENT(s) for GUID %s" % guid)
138139
decompressed_data = zlib.decompress(fragment, zlib.MAX_WBITS | 32)
139140
print("News = %s" % json.loads(decompressed_data))
140141

141142
except KeyError as keyerror:
142143
print('KeyError exception: ', keyerror)
143144
except IndexError as indexerror:
144145
print('IndexError exception: ', indexerror)
146+
except binascii.Error as b64error:
147+
print('base64 decoding exception:', b64error)
145148
except zlib.error as error:
146-
print('zlib exception: ', error)
149+
print('zlib decompressing exception: ', error)
147150
# Some console environments like Windows may encounter this unicode display as a limitation of OS
148151
except UnicodeEncodeError as encodeerror:
149152
print("UnicodeEncodeError exception. Cannot decode unicode character for %s in this enviroment: " %

0 commit comments

Comments
 (0)