Skip to content

Commit ca7328c

Browse files
authored
docs: add recommendation to use v2.x and static discovery artifacts (googleapis#1434)
1 parent 88096a5 commit ca7328c

File tree

2 files changed

+33
-23
lines changed

2 files changed

+33
-23
lines changed

Diff for: README.md

+16-4
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@ where possible, for new code development. For more information, please visit
1616
[Client Libraries Explained](https://cloud.google.com/apis/docs/client-libraries-explained).
1717

1818
## Version 2.0 Release
19-
The 2.0 release of `google-api-python-client` is a significant upgrade compared
20-
to v1. Please see the [Migration Guide](https://github.com/googleapis/google-api-python-client/blob/master/UPGRADING.md) for more information.
21-
As a result of caching the discovery documents, the size of this package is at
22-
least 50 MB larger compared to the previous version.
19+
The 2.0 release of `google-api-python-client` includes a substantial reliability
20+
improvement, compared with 1.x, as discovery documents are now cached in the library
21+
rather than fetched dynamically. It is highly recommended to upgrade from v1.x to v2.x.
22+
23+
Only python 3.6 and newer is supported. If you are not able to upgrade python, then
24+
please continue to use version 1.x as we will continue supporting python 2.7+ in
25+
[v1](https://github.com/googleapis/google-api-python-client/tree/v1).
26+
27+
Discovery documents will no longer be retrieved dynamically when
28+
you call `discovery.build()`. The discovery documents will instead be retrieved
29+
from the client library directly. New versions of this library are released weekly.
30+
As a result of caching the discovery documents, the size of this package is at least
31+
50 MB larger compared to the previous version.
32+
33+
Please see the [Migration Guide](https://github.com/googleapis/google-api-python-client/blob/master/UPGRADING.md)
34+
for more information.
2335

2436
## Documentation
2537

Diff for: UPGRADING.md

+17-19
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
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
58
please 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
912
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.
1316

1417

1518
For users of public APIs
1619
------------------------
1720
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.
2322

2423
For 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
2726
discovery document is private and it will not be shipped with the library.
2827
Only discovery documents listed in [this public directory](https://www.googleapis.com/discovery/v1/apis/)
2928
are included in the library. Users of private APIs should set the
3029
`static_discovery` argument of `discovery.build()` to `False` to continue to
3130
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
3332
specified, the default value for `static_discovery` will be `True` when
3433
the `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
5553
call to `discovery.build()`. Instead, discovery documents are retrieved from
5654
the client library itself.
5755

@@ -78,7 +76,7 @@ from googleapiclient.discovery import build
7876
with 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

Comments
 (0)