blob: 475bd9f5e4518979fdd8db90b7063bf46ff028c3 [file] [log] [blame] [view]
release-please[bot]a9c7ddc2021-03-03 21:52:06 +00001# 2.0.0 Migration Guide
2
3The 2.0 release of `google-api-python-client` is a significant upgrade as only
4python 3.6 and newer is supported. If you are not able to upgrade python, then
5please continue to use version 1.x as we will continue supporting python 2.7+ in
6[v1](https://github.com/googleapis/google-api-python-client/tree/v1).
7
8In addition, discovery documents will no longer be retrieved dynamically when
9you call `discovery.build()`. The discovery documents will instead be retrieved
10from the client library directly. Existing code written for earlier versions of
11this library will not require updating. We believe this new default behaviour
12will provide a more predictable experience for users. If always using the latest
13version of a service definition is more important than reliability, users should
14set the `static_discovery` argument of `discovery.build()` to `False` to
15retrieve the service definition from the internet.
16
17If you experience issues or have questions, please file an [issue](https://github.com/googleapis/google-api-python-client/issues).
18
19## Supported Python Versions
20
21> **WARNING**: Breaking change
22
23The 2.0.0 release requires Python 3.6+, as such you must upgrade to Python 3.6+
24to use version 2.0.0.
25
26## Method Calls
27
28**Note**: Existing code written for earlier versions of this library will not
29require updating. You should only update your code if always using the latest
30version of a service definition is more important than reliability.
31
32> **WARNING**: Breaking change
33
34The 2.0.0 release no longer retrieves discovery documents dynamically on each
35call to `discovery.build()`. Instead, discovery documents are retrieved from
36the client library itself.
37
38Under the hood, the `discovery.build()` function retrieves a discovery artifact
39in order to construct the service object. The breaking change is that the
40`discovery.build()` function will no longer retrieve discovery artifacts
41dynamically. Instead it will use service definitions shipped in the library.
42
43
44**Before:**
45```py
46from googleapiclient.discovery import build
47
48# Retrieve discovery artifacts from the internet
49with build('drive', 'v3') as service:
50 # ...
51```
52
53**After:**
54```py
55from googleapiclient.discovery import build
56
57# Retrieve discovery artifacts from the client library
58with build('drive', 'v3') as service:
59 # ...
60
61# Retrieve discovery artifacts from the internet
62with build('drive', 'v3', static_discovery=False) as service:
63 # ...
64```