Skip to content

Commit 75613df

Browse files
committed
update urlib3 and requests, fix readme and notebook about URL and grammar.
1 parent 2aba2e1 commit 75613df

File tree

4 files changed

+32
-21
lines changed

4 files changed

+32
-21
lines changed

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
FROM python:3.7-alpine
22

33
LABEL maintainer="Wasin Waeosri <wasin.waeosri@rifinitiv.com>"
4-
LABEL build_date="2019-07-30"
4+
LABEL build_date="2021-05-18"
5+
# set working directory
6+
WORKDIR /app
57

68
# Copy requirements.txt first
7-
COPY requirements.txt /
9+
COPY requirements.txt .
810
# instruction to be run during image build
911
RUN pip install -r requirements.txt
1012

1113
# then copy the application
12-
RUN mkdir /app
13-
COPY mrn_console_app.py /app
14-
WORKDIR /app
14+
COPY mrn_console_app.py .
1515

16-
ENTRYPOINT ["python", "/app/mrn_console_app.py"]
16+
ENTRYPOINT ["python", "./mrn_console_app.py"]

README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# WebSocket API Machine Readable News Example with Python
2-
- Last update: Jan 2021
2+
- Last update: May 2021
33
- Environment: Windows and Linux OS
44
- Compiler: Python
55
- Prerequisite: Refinitiv Real-Time Advanced Data Hub and Refinitiv Real-Time Advanced Distribution servers version 3.2.1 and above, MRN service
66

77
## Overview
88

9-
This example shows how developers may use the [Websocket API for Pricing Streaming and Real-Time Service](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api) aka Websocket API application to subscribe Machine Readable News (MRN) from Refinitiv Real-Time Distribution System (Refinitiv Real-Time Advanced Data Hub and Refinitiv Real-Time Advanced Distribution Server). The example just connects to Refinitiv Real-Time via a WebSocket connection, then subscribes and displays MRN News data in a console or classic Jupyter Notebook. The project is implemented with Python language for both console and Jupyter Notebook applications, but the main concept for consuming and assembling MRN News messages are the same for all technologies.
9+
This example shows how developers may use the [Websocket API for Pricing Streaming and Real-Time Service](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api) aka Websocket API application to subscribe Machine Readable News (MRN) from Refinitiv Real-Time Distribution System (Refinitiv Real-Time Advanced Data Hub and Refinitiv Real-Time Advanced Distribution Server). The example just connects to Refinitiv Real-Time via a WebSocket connection, then subscribes and displays MRN News data in a console or classic Jupyter Notebook. The project is implemented with Python language for both console and Jupyter Notebook applications, but the main concept for consuming and assembling MRN News messages are the same for all technologies.
1010

1111
For example of MRN from Refinitiv Real-Time Optimized (formerly known as ERT in Cloud), please switch to [ERT-in-Cloud](https://github.com/Refinitiv-API-Samples/Example.WebSocketAPI.Python.MRN/tree/ERT-in-Cloud) branch.
1212

@@ -16,7 +16,7 @@ Please see the full documentation of this example application in [this article](
1616

1717
## Prerequisite
1818

19-
This example is focusing on the Refinitiv Machine Readable News (MRN) data processing only. I highly recommend you check the [WebSocket API Tutorials](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api/tutorials) page if you are not familiar with WebSocket API.
19+
This example is focusing on the Refinitiv Machine Readable News (MRN) data processing only. I highly recommend you check the [WebSocket API Tutorials](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api/tutorials) page if you are not familiar with WebSocket API.
2020

2121
The Tutorials page provides a step-by-step guide (connect, log in, request data, parse data, etc) for developers who are interested in developing a WebSocket application to consume real-time data from Refinitiv Real-Time.
2222

@@ -29,7 +29,7 @@ Refinitiv Machine Readable News (MRN) is an advanced service for automating the
2929
MRN is published over Refinitiv Real-Time using an Open Message Model (OMM) envelope in News Text Analytics domain messages. The Real-time News content set is made available over MRN_STORY RIC. The content data is contained in a FRAGMENT field that has been compressed and potentially fragmented across multiple messages, to reduce bandwidth and message size.
3030

3131
A FRAGMENT field has a different data type based on a connection type:
32-
* RSSL connection (RTSDK [C++](https://developers.refinitiv.com/en/api-catalog/elektron/elektron-sdk-cc)/[Java](https://developers.refinitiv.com/en/api-catalog/elektron/elektron-sdk-java)): BUFFER type
32+
* RSSL connection (RTSDK [C++](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/rt-sdk-cc)/[Java](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/rt-sdk-java)): BUFFER type
3333
* WebSocket connection: Base64 ASCII string
3434

3535
The data goes through the following series of transformations:
@@ -80,7 +80,7 @@ Please be informed that your Refinitiv Real-Time Advanced Data Hub and Refinitiv
8080

8181
### A console example
8282
1. Go to the project folder in the console
83-
2. Run ```$> pip install -r requestments.txt``` command in a console to install all the dependencies libraries.
83+
2. Run ```$> pip install -r requirements.txt``` command in a console to install all the dependencies libraries.
8484
3. Then you can run mrn_console_app.py application with the following command
8585
```
8686
$> python mrn_console_app.py --hostname <Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
@@ -97,16 +97,18 @@ Optionally, the application subscribes ```MRN_STORY``` RIC code from Real-Time A
9797
```
9898
$> docker run rtsdk_ws_mrn_python --hostname Real-Time Advanced Distribution Server IP Address/Hostname> --port <WebSocket Port> --ric <MRN RIC name>
9999
```
100+
4. If you want to connect the Docker container to a localhost, please use ```host.docker.internal``` as the Host name.
101+
100102
### Classic Jupyter Notebook example
101103
102-
Please be informed that Python [Ananconda](https://www.anaconda.com/distribution/) or [MiniConda](https://docs.conda.io/en/latest/miniconda.html) distribution/package manager is highly recommended for running the Jupyter Notebook example.
104+
Please be informed that Python [Anaconda](https://www.anaconda.com/distribution/) or [MiniConda](https://docs.conda.io/en/latest/miniconda.html) distribution/package manager is highly recommended for running the Jupyter Notebook example.
103105
104106
1. Open Anaconda Prompt and go to the project's folder
105107
2. Run the following command in an Anaconda Prompt to create a Conda environment named *mrn_python_notebook* for the project.
106108
```
107109
(base) $>conda create --name mrn_python_notebook python=3.7
108110
```
109-
3. Once the environment is created, activate Conda environment named ```global_sale``` with this command in Anaconda Prompt
111+
3. Once the environment is created, activate Conda environment named ```mrn_python_notebook``` with this command in Anaconda Prompt
110112
```
111113
(base) $>conda activate mrn_python_notebook
112114
```
@@ -116,7 +118,7 @@ Please be informed that Python [Ananconda](https://www.anaconda.com/distributio
116118

117119
(mrn_python_notebook) $>conda install -c conda-forge pandas
118120

119-
(mrn_python_notebook) $>pip install -r requestments.txt
121+
(mrn_python_notebook) $>pip install -r requirements.txt
120122
```
121123
5. Go to the project's notebook folder in the console
122124
6. Run the following command in a console to start the classic Jupyter Notebook in the notebook folder.
@@ -223,7 +225,7 @@ News = {'altId': 'nIdw5d8Hwd', 'audiences': ['NP:CNRA', 'NP:IDXN'], 'body': 'Lap
223225
224226
For further details, please check out the following resources:
225227
* [Refinitiv Real-Time & Distribution Family page](https://developers.refinitiv.com/en/use-cases-catalog/refinitiv-real-time) on the [Refinitiv Developer Community](https://developers.refinitiv.com/) web site.
226-
* [WebSocket API page](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api).
228+
* [WebSocket API page](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api).
227229
* [Developer Webinar Recording: Introduction to WebSocket API](https://www.youtube.com/watch?v=CDKWMsIQfaw).
228230
* [Introduction to Machine Readable News with WebSocket API](https://developers.refinitiv.com/en/article-catalog/article/introduction-machine-readable-news-elektron-websocket-api-refinitiv).
229231
* [Machine Readable News (MRN) & N2_UBMS Comparison and Migration Guide](https://developers.refinitiv.com/en/article-catalog/article/machine-readable-news-mrn-n2_ubms-comparison-and-migration-guide).

notebook/mrn_notebook_app.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"\n",
99
"## Prerequisite\n",
1010
"\n",
11-
"This article/notebook is focusing on the Refinitiv Machine Readable News (MRN) data processing only. I highly recommend you check the [WebSocket API Tutorials](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api/tutorials) page if you are not familiar with WebSocket API. \n",
11+
"This article/notebook is focusing on the Refinitiv Machine Readable News (MRN) data processing only. I highly recommend you check the [WebSocket API Tutorials](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api/tutorials) page if you are not familiar with WebSocket API. \n",
1212
"\n",
1313
"The Tutorials page provides a step-by-step guide (connect, log in, request data, parse data, etc) for developers who are interested in developing a WebSocket application to consume real-time data from Refinitiv Real-Time. \n",
1414
"\n",
@@ -24,7 +24,7 @@
2424
"MRN is published over Refinitiv Real-Time using an Open Message Model (OMM) envelope in News Text Analytics domain messages. The Real-time News content set is made available over MRN_STORY RIC. The content data is contained in a FRAGMENT field that has been compressed and potentially fragmented across multiple messages, to reduce bandwidth and message size.\n",
2525
"\n",
2626
"A FRAGMENT field has a different data type based on a connection type:\n",
27-
"* RSSL connection (RTSDK [C++](https://developers.refinitiv.com/en/api-catalog/elektron/elektron-sdk-cc)/[Java](https://developers.refinitiv.com/en/api-catalog/elektron/elektron-sdk-java)): BUFFER type\n",
27+
"* RSSL connection (RTSDK [C++](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/rt-sdk-cc)/[Java](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/rt-sdk-java)): BUFFER type\n",
2828
"* WebSocket connection: Base64 ASCII string\n",
2929
"\n",
3030
"The data goes through the following series of transformations:\n",
@@ -1631,7 +1631,7 @@
16311631
"\n",
16321632
"For further details, please check out the following resources:\n",
16331633
"* [Refinitiv Real-Time & Distribution Family page](https://developers.refinitiv.com/en/use-cases-catalog/refinitiv-real-time) on the [Refinitiv Developer Community](https://developers.refinitiv.com/) web site.\n",
1634-
"* [WebSocket API page](https://developers.refinitiv.com/en/api-catalog/elektron/refinitiv-websocket-api).\n",
1634+
"* [WebSocket API page](https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/refinitiv-websocket-api).\n",
16351635
"* [Developer Webinar Recording: Introduction to Electron WebSocket API](https://www.youtube.com/watch?v=CDKWMsIQfaw).\n",
16361636
"* [Introduction to Machine Readable News with WebSocket API](https://developers.refinitiv.com/en/article-catalog/article/introduction-machine-readable-news-elektron-websocket-api-refinitiv).\n",
16371637
"* [Machine Readable News (MRN) & N2_UBMS Comparison and Migration Guide](https://developers.refinitiv.com/en/article-catalog/article/machine-readable-news-mrn-n2_ubms-comparison-and-migration-guide).\n",
@@ -1667,7 +1667,7 @@
16671667
"name": "python",
16681668
"nbconvert_exporter": "python",
16691669
"pygments_lexer": "ipython3",
1670-
"version": "3.7.6"
1670+
"version": "3.7.10"
16711671
}
16721672
},
16731673
"nbformat": 4,

requirements.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1+
astroid==2.4.2
12
autopep8==1.4.4
23
certifi==2019.6.16
34
chardet==3.0.4
5+
colorama==0.4.3
46
idna==2.8
7+
isort==5.5.3
8+
lazy-object-proxy==1.4.3
9+
mccabe==0.6.1
510
pycodestyle==2.5.0
6-
requests==2.22.0
11+
pylint==2.6.0
12+
requests==2.25.1
713
six==1.12.0
8-
urllib3==1.25.3
14+
toml==0.10.1
15+
typed-ast==1.4.1
16+
urllib3>=1.25.8
917
websocket-client==0.56.0
18+
wrapt==1.12.1

0 commit comments

Comments
 (0)