blob: c3c9171ebf5a19028c56c1bab40ab8ec8c67d7d6 [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
Anthonios Parthenioua6f17062021-03-15 10:18:02 -040010from the client library directly.
11
12For users of public APIs
13------------------------
14Existing code written for earlier versions of this library will not require
15updating. We believe this new default behaviour will provide a more predictable
16experience for users. If always using the latest version of a service definition
17is more important than reliability, users should set the `static_discovery`
18argument of `discovery.build()` to `False` to retrieve the service definition
19from the internet.
20
21For users of private APIs
22-------------------------
23If the discovery document requires an authentication key to access it, the
24discovery document is private and it will not be shipped with the library.
25Only discovery documents listed in [this public directory](https://www.googleapis.com/discovery/v1/apis/)
26are included in the library. Users of private APIs should set the
27`static_discovery` argument of `discovery.build()` to `False` to continue to
release-please[bot]a9c7ddc2021-03-03 21:52:06 +000028retrieve the service definition from the internet.
29
30If you experience issues or have questions, please file an [issue](https://github.com/googleapis/google-api-python-client/issues).
31
32## Supported Python Versions
33
34> **WARNING**: Breaking change
35
36The 2.0.0 release requires Python 3.6+, as such you must upgrade to Python 3.6+
37to use version 2.0.0.
38
39## Method Calls
40
41**Note**: Existing code written for earlier versions of this library will not
42require updating. You should only update your code if always using the latest
Anthonios Parthenioua6f17062021-03-15 10:18:02 -040043version of a service definition is more important than reliability or if you
44are using an API which does not have a public discovery document.
release-please[bot]a9c7ddc2021-03-03 21:52:06 +000045
46> **WARNING**: Breaking change
47
48The 2.0.0 release no longer retrieves discovery documents dynamically on each
49call to `discovery.build()`. Instead, discovery documents are retrieved from
50the client library itself.
51
52Under the hood, the `discovery.build()` function retrieves a discovery artifact
53in order to construct the service object. The breaking change is that the
54`discovery.build()` function will no longer retrieve discovery artifacts
55dynamically. Instead it will use service definitions shipped in the library.
56
57
58**Before:**
59```py
60from googleapiclient.discovery import build
61
62# Retrieve discovery artifacts from the internet
63with build('drive', 'v3') as service:
64 # ...
65```
66
67**After:**
68```py
69from googleapiclient.discovery import build
70
71# Retrieve discovery artifacts from the client library
72with build('drive', 'v3') as service:
73 # ...
74
75# Retrieve discovery artifacts from the internet
76with build('drive', 'v3', static_discovery=False) as service:
77 # ...
78```