mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
add README section for https
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -80,3 +80,6 @@ lightning_logs/
|
||||
!openbb_sdk/install_all.sh
|
||||
openbb_sdk/sdk/core/tests/app/model/charts/test_chart_settings.py
|
||||
*/mocked_path
|
||||
|
||||
# CA certificates
|
||||
*.pem
|
||||
|
||||
44
openbb_sdk/sdk/core/README.md
vendored
44
openbb_sdk/sdk/core/README.md
vendored
@@ -23,7 +23,8 @@
|
||||
- [4.1.5. Environment variables](#415-environment-variables)
|
||||
- [4.2 Dynamic version](#42-dynamic-version)
|
||||
- [5. REST API](#5-rest-api)
|
||||
- [5.1 Test users](#51-test-users)
|
||||
- [5.1 HTTPS](#51-https)
|
||||
- [5.2 Test users](#52-test-users)
|
||||
- [6. Front-end typing](#6-front-end-typing)
|
||||
|
||||
## 1. Introduction
|
||||
@@ -398,7 +399,46 @@ OpenBB SDK comes with a ready to use Rest API built with FastAPI. Start the appl
|
||||
uvicorn openbb_core.api.rest_api:app --reload
|
||||
```
|
||||
|
||||
## 5.1 Test users
|
||||
### 5.1 HTTPS
|
||||
|
||||
If you want to run your FastAPI app over HTTPS locally you can use [mkcert](https://github.com/FiloSottile/mkcert) and pass the certificate and key to `uvicorn`.
|
||||
|
||||
0. Install `mkcert` (see instructions [here](https://github.com/FiloSottile/mkcert))
|
||||
1. cd into "openbb_sdk/sdk/core/openbb_core/api"
|
||||
2. Run the following commands:
|
||||
|
||||
```shell
|
||||
mkcert -install
|
||||
mkcert localhost 127.0.0.1 ::1
|
||||
```
|
||||
|
||||
You will see two files created in the current directory.
|
||||
- Certificate: "localhost+2.pem"
|
||||
- Key: "localhost+2-key.pem"
|
||||
|
||||
3. Change the code to start the server inside "rest_api.py" to:
|
||||
|
||||
```python
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
uvicorn.run(
|
||||
"openbb_core.api.rest_api:app",
|
||||
reload=True,
|
||||
ssl_keyfile="./localhost+2-key.pem",
|
||||
ssl_certfile="./localhost+2.pem",
|
||||
)
|
||||
```
|
||||
|
||||
4. Run the server from the terminal with:
|
||||
|
||||
```shell
|
||||
python rest_api.py
|
||||
```
|
||||
|
||||
Your app will be available at https://127.0.0.1:8000/
|
||||
|
||||
### 5.2 Test users
|
||||
|
||||
There are 2 default users for testing purpose:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user