codeocean 0.1.7__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,10 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ ## 0.2.0 (2024-10-21)
5
+
6
+ - [#15](https://github.com/codeocean/codeocean-sdk-python/pull/15) feat: Add option for custom retries
7
+
4
8
  ## 0.1.7 (2024-10-17)
5
9
 
6
10
  - [#14](https://github.com/codeocean/codeocean-sdk-python/pull/14) feat: Add an optional timeout parameter to polling while loops
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: codeocean
3
- Version: 0.1.7
3
+ Version: 0.2.0
4
4
  Summary: Code Ocean Python SDK
5
5
  Project-URL: Homepage, https://github.com/codeocean/codeocean-sdk-python
6
6
  Project-URL: Issues, https://github.com/codeocean/codeocean-sdk-python/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "codeocean"
7
- version = "0.1.7"
7
+ version = "0.2.0"
8
8
  authors = [
9
9
  { name="Code Ocean", email="dev@codeocean.com" },
10
10
  ]
@@ -1,6 +1,8 @@
1
- from requests_toolbelt.sessions import BaseUrlSession
2
- from requests_toolbelt.adapters.socket_options import TCPKeepAliveAdapter
3
1
  from dataclasses import dataclass
2
+ from requests_toolbelt.adapters.socket_options import TCPKeepAliveAdapter
3
+ from requests_toolbelt.sessions import BaseUrlSession
4
+ from typing import Optional
5
+ from urllib3.util import Retry
4
6
 
5
7
  from codeocean.capsule import Capsules
6
8
  from codeocean.computation import Computations
@@ -12,15 +14,16 @@ class CodeOcean:
12
14
 
13
15
  domain: str
14
16
  token: str
17
+ retries: Optional[Retry] = None
15
18
 
16
19
  def __post_init__(self):
17
20
  self.session = BaseUrlSession(base_url=f"{self.domain}/api/v1/")
18
21
  self.session.auth = (self.token, "")
19
- self.session.mount(self.domain, TCPKeepAliveAdapter())
20
22
  self.session.headers.update({"Content-Type": "application/json"})
21
23
  self.session.hooks["response"] = [
22
24
  lambda response, *args, **kwargs: response.raise_for_status()
23
25
  ]
26
+ self.session.mount(self.domain, TCPKeepAliveAdapter(max_retries=self.retries))
24
27
 
25
28
  self.capsules = Capsules(client=self.session)
26
29
  self.computations = Computations(client=self.session)
File without changes
File without changes
File without changes
File without changes
File without changes