50
50
MAX_RETRIES = 5
51
51
MAX_RETRY_BACKOFF = 64 # seconds
52
52
53
- # For how these settings were determined, see
54
- # https://github.com/planetlabs/planet-client-python/issues/580
55
- READ_TIMEOUT = 30.0
53
+ DEFAULT_READ_TIMEOUT_SECS = 125.0
56
54
RATE_LIMIT = 10 # per second
57
55
MAX_ACTIVE = 50
58
56
@@ -231,11 +229,16 @@ class Session(BaseSession):
231
229
```
232
230
"""
233
231
234
- def __init__ (self , auth : Optional [AuthType ] = None ):
232
+ def __init__ (
233
+ self ,
234
+ auth : Optional [AuthType ] = None ,
235
+ read_timeout_secs : Optional [float ] = None ,
236
+ ):
235
237
"""Initialize a Session.
236
238
237
239
Parameters:
238
240
auth: Planet server authentication.
241
+ read_timeout_secs: Maximum time to wait for data to be received.
239
242
"""
240
243
if auth is None :
241
244
# Try getting credentials from environment before checking
@@ -246,8 +249,12 @@ def __init__(self, auth: Optional[AuthType] = None):
246
249
except exceptions .PlanetError :
247
250
auth = Auth .from_file ()
248
251
249
- LOGGER .info (f'Session read timeout set to { READ_TIMEOUT } .' )
250
- timeout = httpx .Timeout (10.0 , read = READ_TIMEOUT )
252
+ if read_timeout_secs is None :
253
+ read_timeout_secs = DEFAULT_READ_TIMEOUT_SECS
254
+
255
+ LOGGER .info (
256
+ f'Session read timeout set to { read_timeout_secs } seconds.' )
257
+ timeout = httpx .Timeout (10.0 , read = read_timeout_secs )
251
258
252
259
headers = {
253
260
'User-Agent' : self ._get_user_agent (), 'X-Planet-App' : 'python-sdk'
0 commit comments