api.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:helper_scripts 作者: pythonanywhere 项目源码 文件源码
def sanity_checks(self, nuke):
        print(snakesay('Running API sanity checks'))
        token = os.environ.get('API_TOKEN')
        if not token:
            raise SanityException(dedent(
                '''
                Could not find your API token.
                You may need to create it on the Accounts page?
                You will also need to close this console and open a new one once you've done that.
                '''
            ))

        if nuke:
            return

        url = API_ENDPOINT.format(username=getpass.getuser()) + self.domain + '/'
        response = call_api(url, 'get')
        if response.status_code == 200:
            raise SanityException(f'You already have a webapp for {self.domain}.\n\nUse the --nuke option if you want to replace it.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号