    async def init_api_tokens(self):
        """Load predefined API tokens (for services) into database"""

        await self._add_tokens(self.service_tokens, kind='service')
        await self._add_tokens(self.api_tokens, kind='user')

        await self.purge_expired_tokens()
        # purge expired tokens hourly
        # we don't need to be prompt about this
        # because expired tokens cannot be used anyway

        pc = PeriodicCallback(
            self.purge_expired_tokens, 1e3 * self.purge_expired_tokens_interval
        )
        self._periodic_callbacks["purge_expired_tokens"] = pc
        pc.start()
Load predefined API tokens (for services) into database
jupyterhub/app.py