1
1
# 2.0.0 Migration Guide
2
2
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
5
8
please continue to use version 1.x as we will continue supporting python 2.7+ in
6
9
[ v1] ( https://github.com/googleapis/google-api-python-client/tree/v1 ) .
7
10
8
- In addition, discovery documents will no longer be retrieved dynamically when
11
+ Discovery documents will no longer be retrieved dynamically when
9
12
you 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.
13
16
14
17
15
18
For users of public APIs
16
19
------------------------
17
20
Existing 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.
23
22
24
23
For users of private APIs
25
24
-------------------------
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
27
26
discovery document is private and it will not be shipped with the library.
28
27
Only discovery documents listed in [ this public directory] ( https://www.googleapis.com/discovery/v1/apis/ )
29
28
are included in the library. Users of private APIs should set the
30
29
` static_discovery ` argument of ` discovery.build() ` to ` False ` to continue to
31
30
retrieve 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
33
32
specified, the default value for ` static_discovery ` will be ` True ` when
34
33
the ` discoveryServiceUrl ` argument of ` discovery.build() ` is provided.
35
34
@@ -45,13 +44,12 @@ to use version 2.0.0.
45
44
## Method Calls
46
45
47
46
** 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.
51
49
52
50
> ** WARNING** : Breaking change
53
51
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
55
53
call to ` discovery.build() ` . Instead, discovery documents are retrieved from
56
54
the client library itself.
57
55
@@ -78,7 +76,7 @@ from googleapiclient.discovery import build
78
76
with build(' drive' , ' v3' ) as service:
79
77
# ...
80
78
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:
83
81
# ...
84
82
```
0 commit comments