You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Small Python example that uses[`httpx`](https://www.python-httpx.org/) to authenticate with the [Data Platform APIs](https://developers.lseg.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis) (RDP, also known as Delivery Platform) OAuth2 **Password Grant** flow and call a couple of RDP REST endpoints.
3
+
Small Python examples that use[`httpx`](https://www.python-httpx.org/) to authenticate with [LSEG Data Platform APIs](https://developers.lseg.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis) (RDP, also known as Delivery Platform) using OAuth2 Password Grant, then call sample REST endpoints.
- Synchronous (blocking) requests with direct `httpx` calls.
9
+
- Demonstrates:
10
+
-`POST /auth/oauth2/v1/token`
11
+
-`GET /data/pricing/chains/v1/`
12
+
-`POST /data/historical-pricing/v1/views/events`
13
+
- Refresh token flow (`grant_type=refresh_token`)
14
+
-`POST /auth/oauth2/v1/revoke`
15
+
16
+
-`src/example_client.py`
17
+
- Synchronous (blocking) script using one shared `httpx.Client` (connection pooling + shared config).
18
+
- Includes simple environment validation and reusable helper methods.
19
+
- Demonstrates the same endpoint flow as above.
13
20
14
21
## Prerequisites
15
22
16
-
- Python 3.10+ recommended
17
-
- RDP credentials:
18
-
-**Machine ID**
19
-
-**Password**
20
-
-**AppKey**
23
+
- Python 3.10+
24
+
-LSEG RDP credentials:
25
+
- Machine ID
26
+
- Password
27
+
- AppKey
21
28
22
-
Please contact LSEG Representative and Account manager to help you get Data Platform access.
29
+
If you do not have access yet, contact your LSEG representative or account manager.
23
30
24
31
## Setup
25
32
26
-
1) Create and activate a virtual environment.
33
+
1. Create and activate a virtual environment.
27
34
28
35
```powershell
29
36
python -m venv .venv
30
37
.\.venv\Scripts\Activate.ps1
31
38
```
32
39
33
-
2) Install dependencies.
40
+
2. Install dependencies.
34
41
35
42
```powershell
36
43
pip install -r requirements.txt
37
44
```
38
45
39
-
3) Create your environment file.
46
+
3. Create your environment file.
40
47
41
48
Copy `src/.env.example` to `src/.env` and fill in values:
42
49
@@ -54,14 +61,18 @@ APPKEY_RDP=<RDP AppKey>
54
61
python .\src\example_sync_httpx.py
55
62
```
56
63
57
-
The script prints the access token (demo only), then prints the JSON responses from the sample endpoints.
64
+
```powershell
65
+
python .\src\example_client.py
66
+
```
58
67
59
-
## Security notes
68
+
For demo purposes, scripts print token/output payloads and endpoint responses.
60
69
61
-
The example uses `verify=False` in `httpx` calls, which **disables TLS certificate verification**. This is unsafe for production—remove `verify=False` (or provide a proper CA bundle) for real usage. I use it in this project to avoid LSEG beloved ZScaler.
70
+
## Security Notes
62
71
63
-
Also avoid printing access tokens in real applications.
72
+
- The examples currently use `verify=False`, which disables TLS certificate verification.
73
+
- This is not safe for production. Remove `verify=False` (or provide a proper CA bundle) for real usage.
74
+
- Avoid printing access tokens in production applications/logs.
0 commit comments