Python 3.7.3pip 18.1google-api-python-client version: 1.12.3build("analytics", "v3", ...)Receive key error in below stack trace where service does not contain rootURL.
a. traced code back to REST call to: "https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest"
b. return from GET to that endpoint does not contain a rootURL entry.
c. cooreponding google bugtracker ticket @ https://issuetracker.google.com/u/1/issues/170661562 opened by another person.
build("analytics", "v3", credentials = get_ga_creds(creds), cache_discovery = False)
~/cddl/sources/google_analytics/extract.py in connect_ga_v3(creds)
48
49 def connect_ga_v3(creds):
---> 50 return build("analytics", "v3", credentials = get_ga_creds(creds), cache_discovery = False)
51
52
/usr/local/lib/python3.7/dist-packages/googleapiclient/_helpers.py 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
/usr/local/lib/python3.7/dist-packages/googleapiclient/discovery.py in build(serviceName, version, http, discoveryServiceUrl, developerKey, model, requestBuilder, credentials, cache_discovery, cache, client_options, adc_cert_path, adc_key_path, num_retries)
286 client_options=client_options,
287 adc_cert_path=adc_cert_path,
--> 288 adc_key_path=adc_key_path,
289 )
290 break # exit if a service was created
/usr/local/lib/python3.7/dist-packages/googleapiclient/_helpers.py 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
/usr/local/lib/python3.7/dist-packages/googleapiclient/discovery.py in build_from_document(service, base, future, http, developerKey, model, requestBuilder, credentials, client_options, adc_cert_path, adc_key_path)
492
493 # If an API Endpoint is provided on client options, use that as the base URL
--> 494 base = urljoin(service["rootUrl"], service["servicePath"])
495 if client_options.api_endpoint:
496 base = client_options.api_endpoint
KeyError: 'rootUrl'
Start having exactly the same problem. It started around 9pm UTC. v1 version of API does have rootUrl key.
Same here, we noticed around 8:53 PM UTC.
There's nothing to do on the library side unfortunately. One thing that may work is downloading the JSON, manually adding a rootURL, and using build_from_document. (This is assuming the discovery doc has no other issues).
from googleapiclient import discovery
with open("analytics_v3.json") as f:
document = f.read()
service = build_from_document(document)
Please continue to +1 on the issue tracker. https://issuetracker.google.com/u/1/issues/170661562
Problems like this will be somewhat mitigated by moving to pre-downloaded discovery docs. #1063
I believe it is possible to get the base URL from the attribute baseUrl instead of composing it from rootUrl.
So, instead of
base = urljoin(service["rootUrl"], service["servicePath"])
you could have
base = service["baseUrl"]
We are experiencing the same issue as of 5:50 this morning AEST.
I believe it is possible to get the base URL from the attribute baseUrl instead of composing it from rootUrl.
So, instead of
base = urljoin(service["rootUrl"], service["servicePath"])you could have
base = service["baseUrl"]
It's strange that the API no longer returns the rootUrl, however.
I believe it is possible to get the base URL from the attribute baseUrl instead of composing it from rootUrl.
So, instead of
base = urljoin(service["rootUrl"], service["servicePath"])
you could have
base = service["baseUrl"]It's strange that the API no longer returns the
rootUrl, however.
Indeed, and even more strange that it is happening only with the Analytics API.
Same problem
it's happened to me also
This happened to me also this afternoon, after 5PM EST. It seems the default service discovery document returned by the discovery endpoint of the client library no longer returns the rootUrl property in the document.
I managed to work around it by copying the response of https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest in a JSON file hosted on S3, in that file I added the rootUrl property that the client library expects like this:
"rootUrl" : "https://www.googleapis.com/"
I then overrode the discoveryServiceUrl endpoint on the build method to point to a different service discovery document hosted by me in a custom endpoint:
service = build('analytics', 'v3', http=http, discoveryServiceUrl="https://example.com/service-discovery-v1.json")
Of course, this is a temporary solution for me since I need to keep my software running, but I ideally Google will fix this soon or provide more guidance.
I hope this helps someone.
Same problem
+1. Facing the same issue. Can someone prioritise this bug please ?
same issue i am facing i changed my timezone from UTC to IST but still no luck
Same issue here. Confirmation and an ETA from Google would be appreciated.
Looks like it's fixed now.
https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest has 'rootUrl' again.
Looks like it's fixed now.
https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest has 'rootUrl' again.
yeah, it's back to normal
It's working for me now. I did have to add cache_discovery=0 to my call to 'build' in order to ignore the cached value. Not sure how to purge the cache.
Most helpful comment
Looks like it's fixed now.
https://www.googleapis.com/discovery/v1/apis/analytics/v3/rest has 'rootUrl' again.