5050MAX_RETRIES = 5
5151MAX_RETRY_BACKOFF = 64 # seconds
5252
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
5654RATE_LIMIT = 10 # per second
5755MAX_ACTIVE = 50
5856
@@ -231,11 +229,16 @@ class Session(BaseSession):
231229 ```
232230 """
233231
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+ ):
235237 """Initialize a Session.
236238
237239 Parameters:
238240 auth: Planet server authentication.
241+ read_timeout_secs: Maximum time to wait for data to be received.
239242 """
240243 if auth is None :
241244 # Try getting credentials from environment before checking
@@ -246,8 +249,12 @@ def __init__(self, auth: Optional[AuthType] = None):
246249 except exceptions .PlanetError :
247250 auth = Auth .from_file ()
248251
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 )
251258
252259 headers = {
253260 'User-Agent' : self ._get_user_agent (), 'X-Planet-App' : 'python-sdk'
0 commit comments