def new_acc(token, symbol, pin): #this function connect GradesKeeper with user's Vulcan account | 3 arguments, no returns if os.path.isfile("cert.json"): os.remove("cert.json") certificate = Vulcan.register(token, symbol, pin) with open("cert.json", "w") as f: json.dump(certificate.json, f)
def register(token=None, symbol=None, pin=None): if not token: token = input('Podaj token: ').strip() if not symbol: symbol = input('Podaj symbol: ').strip() if not pin: pin = input('Podaj PIN: ').strip() if token and symbol and pin: certificate = Vulcan.register(token, symbol, pin) with open('cert.json', 'w') as f: json.dump(certificate.json, f) else: raise ValueError
from CalDavManager import CalDavManager from Config import Config config = Config("main.cfg") caldav = CalDavManager(config) try: with open(config.get("cert"), "r") as file: cert = json.load(file) except FileNotFoundError: print("Cannot find Cert! Creating one:") token = input("Enter Token: ") symbol = input("Enter Symbol: ") pin = input("Enter PIN: ") cert = Vulcan.register(token, symbol, pin) if cert != None: with open(config.get("cert"), "w") as file: file.write(json.dumps(cert.json)) else: print("No cert found!") exit() vulcan = Vulcan(cert) while True: dates = [] for x in range(30): dates.append(datetime.date.today() + datetime.timedelta(days=x))
def logInVulcan(token, symbol, pin): certificate = Vulcan.register(token, symbol, pin) """with open('cert.json', 'w') as f: # You can use other filename json.dump(certificate.json, f)""" return certificate.json