Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default limit #584

Merged
merged 2 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed

- Don't provide a `limit` by default, trust the server to know its limits [#584](https://github.com/stac-utils/pystac-client/pull/584)

## [v0.7.3] - 2023-08-21

### Changed
Expand Down
3 changes: 1 addition & 2 deletions pystac_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from pystac_client.errors import ClientTypeError
from pystac_client.exceptions import APIError
from pystac_client.item_search import (
DEFAULT_LIMIT_AND_MAX_ITEMS,
BBoxLike,
CollectionsLike,
DatetimeLike,
Expand Down Expand Up @@ -475,7 +474,7 @@ def search(
*,
method: Optional[str] = "POST",
max_items: Optional[int] = None,
limit: Optional[int] = DEFAULT_LIMIT_AND_MAX_ITEMS,
limit: Optional[int] = None,
ids: Optional[IDsLike] = None,
collections: Optional[CollectionsLike] = None,
bbox: Optional[BBoxLike] = None,
Expand Down
14 changes: 9 additions & 5 deletions pystac_client/item_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ def __geo_interface__(self) -> Dict[str, Any]:

OPS = list(OP_MAP.keys())

# Previously named DEFAULT_LIMIT_AND_MAX_ITEMS
# aliased for backwards compat
# https://github.com/stac-utils/pystac-client/pull/273
DEFAUL_LIMIT = DEFAULT_LIMIT_AND_MAX_ITEMS = 100

def __getattr__(name: str) -> Any:
if name in ("DEFAUL_LIMIT", "DEFAULT_LIMIT_AND_MAX_ITEMS"):
warnings.warn(
f"{name} is deprecated and will be removed in v0.8", DeprecationWarning
)
return 100
raise AttributeError(f"module {__name__} has no attribute {name}")


# from https://gist.github.com/angstwad/bf22d1822c38a92ec0a9#gistcomment-2622319
Expand Down Expand Up @@ -258,7 +262,7 @@ def __init__(
max_items: Optional[int] = None,
stac_io: Optional[StacApiIO] = None,
client: Optional["_client.Client"] = None,
limit: Optional[int] = DEFAULT_LIMIT_AND_MAX_ITEMS,
limit: Optional[int] = None,
ids: Optional[IDsLike] = None,
collections: Optional[CollectionsLike] = None,
bbox: Optional[BBoxLike] = None,
Expand Down
60 changes: 36 additions & 24 deletions tests/cassettes/test_cli/TestCLI.test_item_search[inprocess].yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAEGU42QC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
H4sIACU/8mQC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
91uQlKy4TpqAgNtPHkvC7oPlYt/BXy7yQ8Yubi66JCdCxhffXPAI/k04VVLLdY4zCp/lPBfmV+Pj
x2gmSMpyog6oK5NsmzOFFsuwi8LZCH4fMU0Vz3IuU1i1YETRDVkJhnRG4MOcJZlURKAESETAGZUL
VjyNUZ+ofIM05SylDJlvNcs12kidswitDijfMPQ5IMBf54T+b8eULgEEjVajBR9Tma6lSvRSXtz8
Expand Down Expand Up @@ -73,26 +73,30 @@ interactions:
22Q55DPmXd5PI9ylUUMSXrwNGsgXb1v9e/Wa7n90irr/Eb2Z7wpnI1QRRedvFK+1lYp3o5DWE+Dl
GXbzFu7mJk/E54BJujVTJw5uugIpsJU//vp/N/ssoZVdAAA=
headers:
Accept-Ranges:
- bytes
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Origin:
- '*'
Content-Encoding:
- gzip
Connection:
- keep-alive
Content-Length:
- '3227'
Content-Type:
- application/json
Date:
- Mon, 21 Aug 2023 16:43:45 GMT
- Fri, 01 Sep 2023 19:44:37 GMT
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Azure-Ref:
- 0QZTjZAAAAACTs1+qTc0PSK86+zFr39VuREVOMzAxMDAwMTA5MDM1ADkyN2FiZmE2LTE5ZjYtNGFmMS1hMDlkLWM5NTlkOWExZTY0NA==
X-Cache:
- CONFIG_NOCACHE
content-encoding:
- gzip
vary:
- Accept-Encoding
x-azure-ref:
- 20230901T194436Z-bmrvv137sd2r314ffnzk0s443400000002v0000000001317
status:
code: 200
message: OK
Expand All @@ -112,7 +116,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAEKU42QC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
H4sIACU/8mQC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
91uQlKy4TpqAgNtPHkvC7oPlYt/BXy7yQ8Yubi66JCdCxhffXPAI/k04VVLLdY4zCp/lPBfmV+Pj
x2gmSMpyog6oK5NsmzOFFsuwi8LZCH4fMU0Vz3IuU1i1YETRDVkJhnRG4MOcJZlURKAESETAGZUL
VjyNUZ+ofIM05SylDJlvNcs12kidswitDijfMPQ5IMBf54T+b8eULgEEjVajBR9Tma6lSvRSXtz8
Expand Down Expand Up @@ -170,26 +174,30 @@ interactions:
22Q55DPmXd5PI9ylUUMSXrwNGsgXb1v9e/Wa7n90irr/Eb2Z7wpnI1QRRedvFK+1lYp3o5DWE+Dl
GXbzFu7mJk/E54BJujVTJw5uugIpsJU//vp/N/ssoZVdAAA=
headers:
Accept-Ranges:
- bytes
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Origin:
- '*'
Content-Encoding:
- gzip
Connection:
- keep-alive
Content-Length:
- '3227'
Content-Type:
- application/json
Date:
- Mon, 21 Aug 2023 16:43:45 GMT
- Fri, 01 Sep 2023 19:44:37 GMT
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Azure-Ref:
- 0QpTjZAAAAABgU8HE1nIwQqBNBtdS3M3bREVOMzAxMDAwMTA5MDM1ADkyN2FiZmE2LTE5ZjYtNGFmMS1hMDlkLWM5NTlkOWExZTY0NA==
X-Cache:
- CONFIG_NOCACHE
content-encoding:
- gzip
vary:
- Accept-Encoding
x-azure-ref:
- 20230901T194437Z-bmrvv137sd2r314ffnzk0s443400000002v000000000131e
status:
code: 200
message: OK
Expand All @@ -213,7 +221,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAEKU42QC/+2da2/jNhaG/0oQoP2yjsX7JYvBop1Fiy6wbTHT/bKDIFBsxdHUlgxJmTRbzH/f
H4sIACU/8mQC/+2da2/jNhaG/0oQoP2yjsX7JYvBop1Fiy6wbTHT/bKDIFBsxdHUlgxJmTRbzH/f
Q+pG2ZNYbmvLFwKdwqElinpJSo9eHx3+flk8L6PL68vvorB4zKK36XweTYo4TS5Hl/dlWX55/eH3
y3gKWz3Et4tbgjDnAt/mT7eI3yKBoIRgTIgwHwjSSMPOd3fpb7DjFWw75ohoQkdYj7WWRKqRLWWU
cSVHBI2R4ITwm9FKY6CWeZz8Wh4/i+bwzcRtX7V1uFzO40loCoOPuf3mIYvuTXOLYplfB8FyHiZR
Expand Down Expand Up @@ -276,26 +284,30 @@ interactions:
EFxK50BwJdhxQvDNOpkmUP9GeIIJ9ZAaev75p/e//DmYymGgTh4MZqdTO0fncKMuYMwhd15YAe3M
MNM8/TVKqqZe257diF4HxKB//jCVZHCT/z/w1OmbWuMAAA==
headers:
Accept-Ranges:
- bytes
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Origin:
- '*'
Content-Encoding:
- gzip
Connection:
- keep-alive
Content-Length:
- '3511'
Content-Type:
- application/geo+json
Date:
- Mon, 21 Aug 2023 16:43:45 GMT
- Fri, 01 Sep 2023 19:44:37 GMT
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
Vary:
- Accept-Encoding
X-Azure-Ref:
- 0QpTjZAAAAABYJYTWotG6TK3yEvs3kBT5REVOMzAxMDAwMTA5MDM1ADkyN2FiZmE2LTE5ZjYtNGFmMS1hMDlkLWM5NTlkOWExZTY0NA==
X-Cache:
- CONFIG_NOCACHE
content-encoding:
- gzip
vary:
- Accept-Encoding
x-azure-ref:
- 20230901T194437Z-bmrvv137sd2r314ffnzk0s443400000002v000000000131g
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 21 Aug 2023 16:43:47 GMT
- Fri, 01 Sep 2023 19:44:38 GMT
Via:
- 1.1 a7bf7cf3a377b5000ee61eea3824eb74.cloudfront.net (CloudFront)
- 1.1 f9a3ca802cab4ac43bafc4dd8667ef98.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- _BPIAqCNBu8gqUT72asS5DZrA3ZmrR_lXCwaxtU_eUyAtpZ1x5llDA==
- s0bors_7PQuckmf2Kxmn-sbmR9SuHVPJjOxE2cKR_mAuep6ClvLfuA==
X-Amz-Cf-Pop:
- DEN52-C1
X-Amzn-Trace-Id:
- Root=1-64e39443-079072de0be3eb14342b3051;Sampled=0;lineage=308471e4:0
- Root=1-64f23f26-4d81223c1cef028c375fc2ab;Sampled=0;lineage=308471e4:0
X-Cache:
- Miss from cloudfront
x-amz-apigw-id:
- KBQanE8fPHcFQaA=
- Kl7OFEbZPHcFewQ=
x-amzn-RequestId:
- de943b6d-f878-4c7e-9a99-afc4565428ea
- 14555b8c-2d58-40a7-9558-a2a816c74fbc
status:
code: 200
message: OK
Expand Down Expand Up @@ -99,21 +99,21 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 21 Aug 2023 16:43:48 GMT
- Fri, 01 Sep 2023 19:44:39 GMT
Via:
- 1.1 a7bf7cf3a377b5000ee61eea3824eb74.cloudfront.net (CloudFront)
- 1.1 f9a3ca802cab4ac43bafc4dd8667ef98.cloudfront.net (CloudFront)
X-Amz-Cf-Id:
- bOEAwwZjKczmO2AGQuLRgNBw-qUa3zzUwboBtT6DfV6YglKfBeSfUQ==
- vhjX4YmtLbkqeQ-Oha3WGWrVdcDreYX0HOc05LObLMTVF1cHN-uV2A==
X-Amz-Cf-Pop:
- DEN52-C1
X-Amzn-Trace-Id:
- Root=1-64e39443-6b6fc5ff2b3795f464f387c2;Sampled=0;lineage=308471e4:0
- Root=1-64f23f26-14922751020f5f7b4857fb9b;Sampled=0;lineage=308471e4:0
X-Cache:
- Miss from cloudfront
x-amz-apigw-id:
- KBQaoGZbPHcFriA=
- Kl7OGGivvHcFZZA=
x-amzn-RequestId:
- c5c676ba-1a4d-46b1-9641-63b34b5ef31b
- b5f2df4d-661f-4d5d-8b75-9b32c363484c
status:
code: 200
message: OK
Expand Down
6 changes: 3 additions & 3 deletions tests/cassettes/test_client/TestAPI.test_from_file.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAEeU42QC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
H4sIACk/8mQC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
91uQlKy4TpqAgNtPHkvC7oPlYt/BXy7yQ8Yubi66JCdCxhffXPAI/k04VVLLdY4zCp/lPBfmV+Pj
x2gmSMpyog6oK5NsmzOFFsuwi8LZCH4fMU0Vz3IuU1i1YETRDVkJhnRG4MOcJZlURKAESETAGZUL
VjyNUZ+ofIM05SylDJlvNcs12kidswitDijfMPQ5IMBf54T+b8eULgEEjVajBR9Tma6lSvRSXtz8
Expand Down Expand Up @@ -86,7 +86,7 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 21 Aug 2023 16:43:51 GMT
- Fri, 01 Sep 2023 19:44:41 GMT
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
X-Cache:
Expand All @@ -96,7 +96,7 @@ interactions:
vary:
- Accept-Encoding
x-azure-ref:
- 20230821T164350Z-kq3y844dfx0rb4633vbu7h8p9s0000000du0000000000c1u
- 20230901T194441Z-7pd633ht0h3et405h7aw61bq9c000000032000000000mhzh
status:
code: 200
message: OK
Expand Down
6 changes: 3 additions & 3 deletions tests/cassettes/test_client/TestAPI.test_instance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interactions:
response:
body:
string: !!binary |
H4sIAESU42QC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
H4sIACc/8mQC/81cbXPbNhL+KxjfzI0zV0iiZKeNb+4DrTfrznqppCTXu+ncQCBEIQEJFqCkqJ3+
91uQlKy4TpqAgNtPHkvC7oPlYt/BXy7yQ8Yubi66JCdCxhffXPAI/k04VVLLdY4zCp/lPBfmV+Pj
x2gmSMpyog6oK5NsmzOFFsuwi8LZCH4fMU0Vz3IuU1i1YETRDVkJhnRG4MOcJZlURKAESETAGZUL
VjyNUZ+ofIM05SylDJlvNcs12kidswitDijfMPQ5IMBf54T+b8eULgEEjVajBR9Tma6lSvRSXtz8
Expand Down Expand Up @@ -86,7 +86,7 @@ interactions:
Content-Type:
- application/json
Date:
- Mon, 21 Aug 2023 16:43:48 GMT
- Fri, 01 Sep 2023 19:44:39 GMT
Strict-Transport-Security:
- max-age=15724800; includeSubDomains
X-Cache:
Expand All @@ -96,7 +96,7 @@ interactions:
vary:
- Accept-Encoding
x-azure-ref:
- 20230821T164348Z-upm9zxn8zp0qfdzegahht2ptzg0000000du0000000003kwd
- 20230901T194439Z-92yazpr19p2hh42b3a52mg8rm4000000032000000000ux1b
status:
code: 200
message: OK
Expand Down
Loading