UnknownApiNameOrVersion exception with commentanalyzer
See original GitHub issueEnvironment details
- OS type and version: latest Manjaro Linux
- Python version: 3.9.1
- pip version: 20.3.1
google-api-python-client
version: 2.0.2
Steps to reproduce
Just got my API access from them, made a project, added an API key, and their sample code wouldn’t work.
- Run code - it’s from the offical website https://support.perspectiveapi.com/s/docs-sample-requests
Code example
from googleapiclient import discovery
import json
API_KEY = ""
# Generates API client object dynamically based on service name and version.
service = discovery.build("commentanalyzer", "v1alpha1", developerKey=API_KEY)
analyze_request = {
"comment": {"text": "friendly greetings from python"},
"requestedAttributes": {"TOXICITY": {}},
}
response = service.comments().analyze(body=analyze_request).execute()
print(json.dumps(response, indent=2))
Stack trace
Traceback (most recent call last):
File "/home/enkeyz/stuff/discord/detox.ai/bot/test.py", line 7, in <module>
service = discovery.build("commentanalyzer", "v1alpha1", developerKey=API_KEY)
File "/home/enkeyz/.local/share/virtualenvs/detox.ai-WfgfN2Jd/lib/python3.9/site-packages/googleapiclient/_helpers.py", line 134, in positional_wrapper
return wrapped(*args, **kwargs)
File "/home/enkeyz/.local/share/virtualenvs/detox.ai-WfgfN2Jd/lib/python3.9/site-packages/googleapiclient/discovery.py", line 273, in build
content = _retrieve_discovery_doc(
File "/home/enkeyz/.local/share/virtualenvs/detox.ai-WfgfN2Jd/lib/python3.9/site-packages/googleapiclient/discovery.py", line 387, in _retrieve_discovery_doc
raise UnknownApiNameOrVersion("name: %s version: %s" % (serviceName, version))
googleapiclient.errors.UnknownApiNameOrVersion: name: commentanalyzer version: v1alpha1
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
UnknownApiNameOrVersion exception when building the ...
Attempt to build the cloudcommerceprocurement api. Code example. def get_procurement_api(): return build('cloudcommerceprocurement', 'v1', ...
Read more >googleapiclient.errors.UnknownApiNameOrVersion: name ...
And when i pass static_discovery=False it building successfully but gets me forbidden error when i try this https://www.googleapis.com/youtube/ ...
Read more >googleapiclient.errors.UnknownApiNameOrVersion
No API with that name and version exists. Instance Methods, [hide private]. Inherited from exceptions.Exception ...
Read more >Exceptions — google-api-core documentation
This module provides base classes for all errors raised by libraries based on google.api_core , including both HTTP and gRPC clients. exception google.api_core....
Read more >Issues-googleapis/google-api-python-client - PythonTechWorld
UnknownApiNameOrVersion exception with commentanalyzer. 888. Environment details OS type and version: latest Manjaro Linux Python version: 3.9.1 pip ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @enkeyz,
From looking at the NodeJS sample linked on the documentation page, it looks like ‘https://commentanalyzer.googleapis.com/$discovery/rest?version=v1alpha1’ is the discovery URL.
I’ll reach out to the comment analyzer team to see if they can get their API listed in the directory.
Hi folks,
Please see https://github.com/googleapis/google-api-python-client/issues/1225.