perspective icon indicating copy to clipboard operation
perspective copied to clipboard

build() got an unexpected keyword argument 'static_discovery'

Open reichaves opened this issue 3 years ago • 1 comments

Hi

In python 3 I am using the Perspective API project. I enabled an api_key and received confirmation by email

But I got this error when I tried to use it - I used the same example from the tutorial:

client = discovery.build(
        "commentanalyzer",
        "v1alpha1",
        developerKey=API_KEY,
        discoveryServiceUrl="https://commentanalyzer.googleapis.com/$discovery/rest?version=v1alpha1",
        static_discovery=False,
        )

---------------------------------------------------------------------------

TypeError                                 Traceback (most recent call last)

[<ipython-input-7-0eef0f741764>](https://localhost:8080/#) in <module>
     12         developerKey=API_KEY,
     13         discoveryServiceUrl="https://commentanalyzer.googleapis.com/$discovery/rest?version=v1alpha1",
---> 14         static_discovery=False,
     15         )
     16 

[/usr/local/lib/python3.7/dist-packages/googleapiclient/_helpers.py](https://localhost:8080/#) in positional_wrapper(*args, **kwargs)
    132                 elif positional_parameters_enforcement == POSITIONAL_WARNING:
    133                     logger.warning(message)
--> 134             return wrapped(*args, **kwargs)
    135 
    136         return positional_wrapper

TypeError: build() got an unexpected keyword argument 'static_discovery'

Please, does anyone know how to resolve this error?

reichaves avatar Oct 10 '22 17:10 reichaves

The problem is that the script doesn't work as a notebook inside Colab. I tested it now as .py and it worked

reichaves avatar Oct 10 '22 18:10 reichaves