【问题标题】:Where / how to store API keys in Google Colabs securely?在哪里/如何在 Google Colabs 中安全地存储 API 密钥?
【发布时间】:2020-08-04 00:31:30
【问题描述】:

如果我与其他人共享例如 Google Colab ipynb,我不希望他们能够访问我的 API 密钥。在 AWS 中,Lambda 的 Parameter Store 中会有类似 SecureString 的东西。有类似的东西可以与 Google Colabs 一起使用吗?谢谢

【问题讨论】:

    标签: pandas jupyter-notebook jupyter google-colaboratory


    【解决方案1】:

    您可以将密钥保存在 Google 云端硬盘中。然后安装并加载它。

    其他人可以自行安装和加载。

    【讨论】:

      【解决方案2】:

      我现在就是这样做的

      drive.mount('/content/drive')
      with open('testLALALALA.json') as jsonfile:
          KEY_DATA = json.load(jsonfile)
      
      
      def initialize_analyticsreporting():
        credentials = ServiceAccountCredentials.from_json_keyfile_dict(KEY_DATA, SCOPES)
        analytics = build('analyticsreporting', 'v4', credentials=credentials)
        return analytics
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-01-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-11-16
        • 2015-11-24
        • 2014-06-24
        相关资源
        最近更新 更多