start pull cmd

This commit is contained in:
Diogo Sousa
2023-01-27 14:54:23 +00:00
parent 6e1c068e24
commit 95f4febbf7
2 changed files with 23 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
import argparse
import json
import logging
from typing import List, Dict
from pathlib import Path
@@ -12,6 +13,7 @@ from openbb_terminal.core.config.paths import USER_ROUTINES_DIRECTORY
from openbb_terminal import feature_flags as obbff
from openbb_terminal.menu import session
from openbb_terminal.session import hub_model as Hub
from openbb_terminal.session.user import User
# from openbb_terminal.session.user import User
@@ -115,7 +117,18 @@ class AccountController(BaseController):
def call_pull(self, _):
"""Pull data"""
console.print("Pull, Diff and Merge.")
response = Hub.fetch_user_configs(User.get_session())
if response:
console.print("Remote data:", style="info")
console.print(json.loads(response.content))
i = console.input(
"\nDo you want to overwrite your local configurations "
"with the remote? (y/n): "
)
if i.lower() in ["y", "yes"]:
console.print("[green]\nApplied remote configs.[/green]")
else:
console.print("\nAborted.", style="info")
def call_clear(self, _):
"""Clear data"""

View File

@@ -31,6 +31,15 @@ class User:
# Add username to flair
User.update_flair()
@classmethod
def get_session(cls):
"""Get session info."""
return {
"token_type": User._TOKEN_TYPE,
"access_token": User._TOKEN,
"uuid": User._UUID,
}
@staticmethod
def update_flair():
MAX_FLAIR_LEN = 20