Skip to content

Commit

Permalink
Merge pull request #27 from harveymmaunders/readme-update
Browse files Browse the repository at this point in the history
README update
  • Loading branch information
harveymmaunders authored Jan 17, 2025
2 parents 3427480 + a5a246f commit 7568ecc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 20 deletions.
2 changes: 1 addition & 1 deletion client-samples/java/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Type in the appropriate command to launch the application

* Windows: `gradlew.bat bootRun`
* Mac/Linux: `./gradlew bootRun`
curl -X GET -v --header "Authorization: Bearer $ACCESS_TOKEN" --header 'Accept: application/json' https://api.morganstanley.com/hello/services'


# Legal

Expand Down
1 change: 1 addition & 0 deletions client-samples/java/websockets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Note that this example sets `$ACCESS_TOKEN`, `$PROXY_HOST` and `$PROXY_PORT` as

```bash
wscat -H "Authorization: Bearer $ACCESS_TOKEN" --proxy "http://$PROXY_HOST:$PROXY_PORT" -c wss://api.morganstanley.com/websocket-api
```

# Legal

Expand Down
2 changes: 1 addition & 1 deletion client-samples/python/rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ It uses the following libraries:
It requires some simple security configuration to enable you to authenticate to the platform.

## Requirements
- Python 3.8+
- Python 3.9+
- A client application on Morgan Stanley Azure AD tenant. Please talk to your contact at Morgan Stanley to set this up.
- A self-signed public/private key pair. Please see the client setup guide for instructions to generate this.
- The thumbprint (also known as fingerprint) for your certificate.
Expand Down
53 changes: 35 additions & 18 deletions client-samples/python/websockets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ It uses the following libraries:
- [Microsoft's `msal` library](https://github.com/AzureAD/microsoft-authentication-library-for-python) for getting access tokens from Azure AD
- The [`websocket-client` library](https://github.com/websocket-client/websocket-client/tree/master) to handle WebSocket connections

It requires some simple security configuration to enable you to authenticate to the platform.

## Requirements
- Python 3.9+
Expand All @@ -12,19 +13,6 @@ It uses the following libraries:
- The thumbprint (also known as fingerprint) for your certificate.
- You can retrieve this from your certificate using OpenSSL with the following command: `openssl x509 -noout -fingerprint -in cert.cer`

## Installation
```bash
# create a virtual environment in the 'virtualenv' folder
# NOTE: this is optional but recommended
python -m venv venv

source virtualenv/bin/activate # on Linux, using bash
.\venv\Scripts\activate # on Windows

python -m pip install --upgrade pip
pip install -r requirements.txt
```

## Configuration
Create a file, config.json, with the following properties:
- `client_id`: Your Client Id for the Morgan Stanley API Platform. This is a GUID.
Expand Down Expand Up @@ -52,6 +40,40 @@ If you want to reduce the amount of logs output, please remove this line from th
websocket.enableTrace(True)
```

## Running the application
It is important to ensure that you have Python 3.9 or greater on your machine. To check if Python is on your machine perform the following:

* Windows: `python --version`
* Mac/Linux: `python --version`

If the command is not recognised then you will need to install Python on your machine.
This can be done by visiting <https://www.python.org/downloads/> where you can follow the instructions to download and install python.

Once Python is installed you can run following to launch the application. Please refer to the docs for current best practice on creating a virtual env https://docs.python.org/3/tutorial/venv.html:

Windows:
```cmd
python -m venv venv
.\venv\Scripts\activate
python -m pip install --upgrade pip
pip install -r requirements.txt
python client.py
```

Mac/Linux:
```bash
python -m venv venv
. venv/bin/activate

python -m pip install --upgrade pip
pip install -r requirements.txt
python client.py
```

The application will launch and connect to the Morgan Stanley API offering and output the result.

## Testing
The tests have been built using the `unittest` framework, but can be run using the `pytest` command.
```bash
Expand All @@ -65,11 +87,6 @@ This project uses `black` to lint its source code for readability. To lint the c
black .
```

## Running the app
```bash
python client.py
```

# Manual testing of WebSocket APIs with wscat
An alternative to this script is to test your application using a command-line tool. `cURL` is intended for regular HTTP requests, and is not recommended for testing WebSockets.
One utility you can use instead is [`wscat`](https://github.com/websockets/wscat). Please see the `wscat` docs for full reference on the available options.
Expand Down

0 comments on commit 7568ecc

Please sign in to comment.