【问题标题】:How to run python code inside github workflow?如何在 github 工作流程中运行 python 代码?
【发布时间】:2021-12-02 00:38:26
【问题描述】:

我有以下 GitHub 工作流程,我需要在其中运行 python 代码来获取令牌,但在运行这些步骤后,我收到错误“ModuleNotFoundError: No module named 'authlib'”我已经安装了所需的依赖项。当我在本地运行时工作正常请有人帮助我

- name: Get Token
        run: |
          python -m pip install --upgrade pip
          pip install requests-oauthlib
          python -c "from authlib.integrations.requests_client import OAuth2Session;"
          if __name__ == '__main__':
           from authlib.integrations.requests_client import OAuth2Session

          token_endpoint = "https://example.com"

          client_id = "********"
          client_secret = "******"

          session = OAuth2Session(client_id, client_secret)
          session.fetch_token(token_endpoint)
          access_token = session.token["access_token"]

          print(access_token)

【问题讨论】:

标签: python github github-actions cicd


【解决方案1】:

请安装 Authlib 包。 https://pypi.org/project/Authlib/

pip install Authlib

【讨论】:

  • 感谢它的魅力!
猜你喜欢
  • 2020-04-02
  • 2021-12-24
  • 2020-09-11
  • 2020-07-16
  • 1970-01-01
  • 2020-01-01
  • 2021-10-25
  • 2023-01-05
  • 1970-01-01
相关资源
最近更新 更多