|
2 | 2 | # | This source code is provided under the Apache 2.0 license -- |
3 | 3 | # | and is provided AS IS with no warranty or guarantee of fit for purpose. -- |
4 | 4 | # | See the project's LICENSE.md for details. -- |
5 | | -# | Copyright Thomson Reuters 2017. All rights reserved. -- |
| 5 | +# | Copyright Refinitiv 2019. All rights reserved. -- |
6 | 6 | # |----------------------------------------------------------------------------- |
7 | 7 |
|
8 | 8 |
|
|
21 | 21 | import zlib |
22 | 22 |
|
23 | 23 | # Global Default Variables |
24 | | -hostname = '172.20.33.30' |
| 24 | +hostname = '127.0.0.1' |
25 | 25 | port = '15000' |
26 | 26 | user = 'root' |
27 | 27 | app_id = '256' |
@@ -66,7 +66,7 @@ def processRefresh(ws, message_json): |
66 | 66 |
|
67 | 67 |
|
68 | 68 | def processMRNUpdate(ws, message_json): # process incoming News Update messages |
69 | | - print("RECEIVED: Update Message") |
| 69 | + #print("RECEIVED: Update Message") |
70 | 70 | # print(message_json) |
71 | 71 |
|
72 | 72 | fields_data = message_json["Fields"] |
@@ -135,15 +135,18 @@ def processMRNUpdate(ws, message_json): # process incoming News Update messages |
135 | 135 |
|
136 | 136 | # News Fragment(s) completed, decompress and print data as JSON to console |
137 | 137 | if tot_size == len(fragment): |
| 138 | + print("decompress News FRAGMENT(s) for GUID %s" % guid) |
138 | 139 | decompressed_data = zlib.decompress(fragment, zlib.MAX_WBITS | 32) |
139 | 140 | print("News = %s" % json.loads(decompressed_data)) |
140 | 141 |
|
141 | 142 | except KeyError as keyerror: |
142 | 143 | print('KeyError exception: ', keyerror) |
143 | 144 | except IndexError as indexerror: |
144 | 145 | print('IndexError exception: ', indexerror) |
| 146 | + except binascii.Error as b64error: |
| 147 | + print('base64 decoding exception:', b64error) |
145 | 148 | except zlib.error as error: |
146 | | - print('zlib exception: ', error) |
| 149 | + print('zlib decompressing exception: ', error) |
147 | 150 | # Some console environments like Windows may encounter this unicode display as a limitation of OS |
148 | 151 | except UnicodeEncodeError as encodeerror: |
149 | 152 | print("UnicodeEncodeError exception. Cannot decode unicode character for %s in this enviroment: " % |
|
0 commit comments