Skip to content

Version 2.0.2 causes UnknownApiNameOrVersion for trends v1beta when attempting service build #1263

@reytchison

Description

@reytchison

Environment details

  • OS type and version: Windows 10
  • Python version: 3.8.5
  • pip version: 21.0.1
  • anaconda version: conda 4.9.2
  • google-api-python-client version: 2.0.2

Steps to reproduce

  • NOTE: Code works with 1.12.8 of google-api-python-client. The error occurs with version 2.0.2.
    1. Create discovery URL for version 'v1beta' of api 'trends' .
    2. Attempt to build a service for that URL

Code example

    discovery_url = 'https://trends.googleapis.com/$discovery/rest?version=v1beta'
    service = build('trends', 'v1beta', developerKey=api_key,
                    discoveryServiceUrl=discovery_url)

Stack trace

Traceback (most recent call last):
  File "trends.py", line 192, in <module>
    t = Trends()
  File "trends.py", line 23, in __init__
    self.service = build('trends', self.api_version, developerKey=self.key,
  File "C:\ProgramData\Anaconda3\envs\trends-code\lib\site-packages\googleapiclient\_helpers.py", line 134, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "C:\ProgramData\Anaconda3\envs\trends-code\lib\site-packages\googleapiclient\discovery.py", line 273, in build
    content = _retrieve_discovery_doc(
  File "C:\ProgramData\Anaconda3\envs\trends-code\lib\site-packages\googleapiclient\discovery.py", line 387, in _retrieve_discovery_doc
    raise UnknownApiNameOrVersion("name: %s  version: %s" % (serviceName, version))
googleapiclient.errors.UnknownApiNameOrVersion: name: trends  version: v1beta

Notes

  • I notice that trends with version 'v1beta' is not listed on the supported APIs here However, it still works with the older version of the package (1.12.8) and 'v1beta' was the version initially recommended to me by a Google employee.

Metadata

Metadata

Assignees

Labels

type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions