“ImportError: file_cache is unavailable” when using Python client for Google service account file_cache

后端 未结 8 1742
孤城傲影
孤城傲影 2021-01-30 16:03

I\'m using a service account for G Suite with full domain delegation. I have a script with readonly access to Google Calendar. The script works just fine, but throws an error (o

相关标签:
8条回答
  • 2021-01-30 16:55

    To use the Google API for Python client, you need to install it first as Google API is not built-in within the Python modules. The instruction is found in Install the Library.

    Installation

    You can either use a package manager or download and install the Python client library manually:

    Managed installation

    Use pip or setuptools to manage your installation (you might need to run sudo first):

    pip (preferred):

    $ pip install --upgrade google-api-python-client

    Setuptools: Use the easy_install tool included in the setuptools package:

    $ easy_install --upgrade google-api-python-client

    0 讨论(0)
  • 2021-01-30 16:57

    Here is how I use google-api-python-client to build a service on Cloud Functions.

    # for Cloud Functions use
    def get_service():
        import googleapiclient.discovery
        return googleapiclient.discovery.build('compute', 'v1',  cache_discovery=False)
    

    And finally it worked.

    0 讨论(0)
提交回复
热议问题