Ejemplo n.º 1
0
 def MFALogin(self, auth_info):
     """
     Login with MFA codes
     """
     totp = pyotp.TOTP(auth_info["token"]).now()
     try:
         login = rs.login(auth_info["user_name"],
                          auth_info["user_passwd"],
                          store_session=True,
                          mfa_code=totp)
     except:
         print(
             f"{bColors.FAIL}Fail: Unable to login robinhood by given credentials.{bColors.ENDC}"
         )
         sys.exit()
     print(f"{bColors.OKGREEN}Info: Login successful.{bColors.ENDC}")
     f = open(os.devnull, "w")
     rs.set_output(f)
Ejemplo n.º 2
0
import getpass
import locale
import logging
import os
import pickle
from datetime import datetime
from random import SystemRandom
from time import sleep

try:
    import pyotp
    import robin_stocks.robinhood as r
    import robin_stocks.robinhood.helper as rh

    r.set_output(open(os.devnull, "w"))
except ImportError:
    pass

locale.setlocale(locale.LC_ALL, "")

LOG_LEVEL = logging.INFO

logger = logging.getLogger()

handler = logging.FileHandler("crypto.log")
formatter = logging.Formatter("%(asctime)s: %(message)s")
handler.setFormatter(formatter)
logger.addHandler(handler)

handler = logging.StreamHandler()
handler.setFormatter(formatter)