11# 2.0.0 Migration Guide
22
3- The 2.0 release of ` google-api-python-client ` is a significant upgrade as only
4- python 3.6 and newer is supported. If you are not able to upgrade python, then
3+ The 2.0 release of ` google-api-python-client ` includes a substantial reliability
4+ improvement, compared with 1.x, as discovery documents are now cached in the library
5+ rather than fetched dynamically. It is highly recommended to upgrade from v1.x to v2.x.
6+
7+ Only python 3.6 and newer is supported. If you are not able to upgrade python, then
58please continue to use version 1.x as we will continue supporting python 2.7+ in
69[ v1] ( https://github.com/googleapis/google-api-python-client/tree/v1 ) .
710
8- In addition, discovery documents will no longer be retrieved dynamically when
11+ Discovery documents will no longer be retrieved dynamically when
912you call ` discovery.build() ` . The discovery documents will instead be retrieved
10- from the client library directly. As a result of caching the discovery
11- documents, the size of this package is at least 50 MB larger compared to the
12- previous version.
13+ from the client library directly. New versions of this library are released weekly.
14+ As a result of caching the discovery documents, the size of this package is at least
15+ 50 MB larger compared to the previous version.
1316
1417
1518For users of public APIs
1619------------------------
1720Existing code written for earlier versions of this library will not require
18- updating. We believe this new default behaviour will provide a more predictable
19- experience for users. If always using the latest version of a service definition
20- is more important than reliability, users should set the ` static_discovery `
21- argument of ` discovery.build() ` to ` False ` to retrieve the service definition
22- from the internet.
21+ updating.
2322
2423For users of private APIs
2524-------------------------
26- If the discovery document requires an authentication key to access it, the
25+ If the discovery document requires an authentication key to access it then the
2726discovery document is private and it will not be shipped with the library.
2827Only discovery documents listed in [ this public directory] ( https://www.googleapis.com/discovery/v1/apis/ )
2928are included in the library. Users of private APIs should set the
3029` static_discovery ` argument of ` discovery.build() ` to ` False ` to continue to
3130retrieve the service definition from the internet. As of version 2.1.0,
32- for backwards compatability with version 1.x, if ` static_discovery ` is not
31+ for backwards compatibility with version 1.x, if ` static_discovery ` is not
3332specified, the default value for ` static_discovery ` will be ` True ` when
3433the ` discoveryServiceUrl ` argument of ` discovery.build() ` is provided.
3534
@@ -45,13 +44,12 @@ to use version 2.0.0.
4544## Method Calls
4645
4746** Note** : Existing code written for earlier versions of this library will not
48- require updating. You should only update your code if always using the latest
49- version of a service definition is more important than reliability or if you
50- are using an API which does not have a public discovery document.
47+ require updating. You should only update your code if you are using an API
48+ which does not have a public discovery document.
5149
5250> ** WARNING** : Breaking change
5351
54- The 2.0.0 release no longer retrieves discovery documents dynamically on each
52+ The 2.0 release no longer retrieves discovery documents dynamically on each
5553call to ` discovery.build() ` . Instead, discovery documents are retrieved from
5654the client library itself.
5755
@@ -78,7 +76,7 @@ from googleapiclient.discovery import build
7876with build(' drive' , ' v3' ) as service:
7977 # ...
8078
81- # Retrieve discovery artifacts from the internet
82- with build(' drive' , ' v3' , static_discovery = False ) as service:
79+ # Retrieve discovery artifacts from the internet for a private API
80+ with build(' drive' , ' v3' , static_discovery = False , developerKey = XXXXX ) as service:
8381 # ...
8482```
0 commit comments