acc.username = member.username session.add(acc) session.commit() session.refresh(acc) acc_id = acc.id else: acc_id = acc_in_db.id hiscores = member.hiscores if hiscores != None: most_rec = session.query(SkillTable).filter(SkillTable.account_id == acc_id).filter( SkillTable.skill_id == 0).order_by("timestamp").first() if most_rec != None: if hiscores["Overall"]["XP"] > most_rec.xp: add_hiscore(hiscores, acc_id, session) else: add_hiscore(hiscores, acc_id, session) if __name__ == "__main__": engine = _create_engine() clan_name = BaseConfig.CLAN_NAME clan = RSClan(clan_name) if not engine.dialect.has_table(engine, SkillTable): Base().metadata.create_all(engine) Session = sessionmaker(bind=engine) session = Session() _do_service(session)
def to_json(self): data = Base.to_json(self) data['options'] = [o.to_json() for o in self.options] return data
def to_json(self): res = Base.to_json(self) res['level'] = self.level return res
def __init__(self): Base.__init__(self)
def to_json(self): data = Base.to_json(self) data['name'] = f'{self.size} / {self.color}' return data
def __init__(self, **kwargs): Base.__init__(self, **kwargs)
def setUp(self): self.app = app.test_client() self.db = Base.get_db()