__init__.py 文件源码

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

项目:archivertools 作者: datatogether 项目源码 文件源码
def __getJWT(self):
        """
        requests JWT from Data Together API. Requires that the environment variable MORPH_DT_API_KEY is set
        """
        try:
            api_key = os.environ['MORPH_DT_API_KEY']
        except KeyError:
            raise KeyError('Data Together API Key not set. Set the environment variable MORPH_DT_API_KEY '
                    'to your Data Together API Key. For instructions on how to do this in morph.io, see '
                    'https://morph.io/documentation/secret_values')
        h = {'access_token':api_key}
        token = requests.post('https://ident.archivers.space/jwt', headers=h).content
        pubkey = requests.get('https://ident.archivers.space/publickey').content
        try:
            jwt.decode(token, pubkey, algorithms=['RS256'])
        except jwt.exceptions.DecodeError as E:
            logging.error('Could not verify Data Together signature on JWT')
            raise
        return token
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号