Пример #1
0
def create_statuses():
    s = create_session()
    api = Status(name='API user', id=0)
    s.add(api)
    admin = Status(name='admin', id=1)
    s.add(admin)
    user = Status(name='user', id=2)
    s.add(user)
    s.commit()
Пример #2
0
    def get_status(self):
        attempts_remaining = 5
        while attempts_remaining > 0:
            try:
                self.status = Status()
                break

            except ValueError as error_message:
                self.network_issues = True
                debug.error("Failed to refresh the Status data. {} attempt remaining.".format(attempts_remaining))
                debug.error(error_message)
                attempts_remaining -= 1
                self.status = []
                sleep(NETWORK_RETRY_SLEEP_TIME)