feat: Add option for custom retries#15
Conversation
|
@jtyoung84 Turns out you can only mount a single HTTPAdapter. See here. LMK what you think, and if OK I'll merge this. |
I tested it out and it works. Looks good to merge. Thanks! |
|
Sorry I didn't get a chance to look at this sooner. This merge actually changes the default behavior from 0 retries to 3.
...and And it looks like this is true in practice: >>> aind_session.get_codeocean_client().session.adapters['https://codeocean.allenneuraldynamics.org'].max_retries
Retry(total=0, connect=None, read=False, redirect=None, status=None)
>>> aind_session.get_codeocean_client().session.adapters['https://codeocean.allenneuraldynamics.org'].max_retries
Retry(total=3, connect=None, read=None, redirect=None, status=None)To get the previous behavior, the default should just be set to zero (tested and it works): @dataclass
class CodeOcean:
domain: str
token: str
retries: Optional[Retry | int] = 0
...The type annotation should probably reflect that |
Closes #12
_optional_adaptersfield to CodeOcean data class. Default is empty tuple. Suppressed from class repr.__post_init__