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

后端 未结 8 1747
孤城傲影
孤城傲影 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:40

    to add to the selected answer, if the build function is called by a dependency, and there is no easy way to update it's code, this code can be used to force cache_discovery to be False:

    import googleapiclient.discovery
    
    _build = googleapiclient.discovery.build
    
    
    def no_cache_build(*args, **kw):
        kw["cache_discovery"] = False
        return _build(*args, **kw)
    
    
    googleapiclient.discovery.build = no_cache_build
    

提交回复
热议问题