Files
OpenBB/openbb_terminal/core/models/profile_model.py
teh_coderer 979930b9e8 feature / Refactor Interactive Charts to React (#4941)
* init

* fix tables

* add shortcuts

* handle svgs

* test

* test2

* test3

* Update loggers.py

* Update sdk_helpers.py

* Update loggers.py

* Update loggers.py

* updates

* updates

* update

* handle add text high/low for candlestick traces when updating

* adding save overlay to tables

* maybe fix

* prints

* asdf

* working

* working

* removing prints

* update

* fix no figure title text

* add trace labels space

* download finished popup for MacOS

* bump pywry

* update

* update table

* Update plotly_helper.py

* only format numbers over 10_000 on tables

* Delete generate_index.py

* turn off logs in generations

* update tables

* bump pywry, fix tables, added ichimoku ta indicator

* Update backend.py

* mypy

* update tables

* updates

* juan more

* tables

* test

* bump pywry

* bump pywry

* Update loggers.py

* test

* fixing some formatting

* add update button to indicators dashboard

* fix oecd dates to be full dates

* prepare charts/tables for pywry update

* Update poetry.lock

* Update finviz_view.py

* tests

* tests

* tests

* tests

* testss?

* tests

* Create test_call_func[call_sec-nasdaq_view.sec_filings-other_args37-called_with37].yaml

* testtss please

* Update loggers.py

* testss

* `with open(newline="\n")`

* tests

* tests -__-

* why

* Revert "`with open(newline="\n")`"

This reverts commit 554e0f53f4.

* Revert "why"

This reverts commit 89f1d9b823.

* Revert "tests -__-"

This reverts commit a9c694ae96.

* Revert "tests"

This reverts commit 5463249498.

* whelp

* .

* rename `streamlit.py` -> `streamlit_run.py`,  bump pywry/finviz/streamlit

* Update backend.py

* update

* Revert "update file"

---------

Co-authored-by: andrewkenreich <andrew.kenreich@gmail.com>
Co-authored-by: James Maslek <jmaslek11@gmail.com>
2023-05-11 17:38:12 +00:00

84 lines
1.9 KiB
Python

from typing import Dict
from pydantic.dataclasses import dataclass
from openbb_terminal.core.models import BaseModel
@dataclass(config=dict(validate_assignment=True, frozen=True))
class ProfileModel(BaseModel):
"""Data model for profile."""
token_type: str = ""
token: str = ""
uuid: str = ""
email: str = ""
username: str = ""
remember: bool = True
def load_user_info(self, session: dict, email: str, remember: bool):
"""Load user info from login info.
Parameters
----------
session : dict
The login info.
email : str
The email.
remember : bool
Remember the session.
"""
self.token_type = session.get("token_type", "")
self.token = session.get("access_token", "")
self.uuid = session.get("uuid", "")
self.email = email
self.username = self.email[: self.email.find("@")]
self.remember = remember
def get_uuid(self) -> str:
"""Get uuid.
Returns
-------
str
The uuid.
"""
return self.uuid
def get_token(self) -> str:
"""Get token.
Returns
-------
str
The token.
"""
return self.token
def get_session(self) -> Dict[str, str]:
"""Get session info.
Returns
-------
Dict[str, str]
The session info.
"""
return {
"token_type": self.token_type,
"access_token": self.token,
"uuid": self.uuid,
}
def get_auth_header(self) -> str:
"""Get auth header.
Returns
-------
str
The auth header, e.g. "Bearer <token>".
"""
return f"{self.token_type.title()} {self.token}"
def __repr__(self) -> str: # pylint: disable=useless-super-delegation
return super().__repr__()