codeocean 0.3.1__tar.gz → 0.3.2__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,9 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ ## 0.3.2 (2025-02-21)
5
+ - [#33](https://github.com/codeocean/codeocean-sdk-python/pull/33) feat: add iterator function for search capsule API
6
+
4
7
  ## 0.3.1 (2025-01-30)
5
8
  - [#31](https://github.com/codeocean/codeocean-sdk-python/pull/31) fix: set fields as optional fields according to openapi spec
6
9
  - [#30](https://github.com/codeocean/codeocean-sdk-python/pull/30) fix: make all DataAssetUpdateParams fields optional
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codeocean
3
- Version: 0.3.1
3
+ Version: 0.3.2
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.3.1"
7
+ version = "0.3.2"
8
8
  authors = [
9
9
  { name="Code Ocean", email="dev@codeocean.com" },
10
10
  ]
@@ -2,7 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
4
  from dataclasses_json import dataclass_json
5
- from typing import Optional
5
+ from typing import Optional, Iterator
6
6
  from requests_toolbelt.sessions import BaseUrlSession
7
7
 
8
8
  from codeocean.components import Ownership, SortOrder, SearchFilter
@@ -113,3 +113,18 @@ class Capsules:
113
113
  res = self.client.post("capsules/search", json=search_params.to_dict())
114
114
 
115
115
  return CapsuleSearchResults.from_dict(res.json())
116
+
117
+ def search_capsules_iterator(self, search_params: CapsuleSearchParams) -> Iterator[Capsules]:
118
+ params = search_params.to_dict()
119
+ while True:
120
+ response = self.search_capsules(
121
+ search_params=CapsuleSearchParams(**params)
122
+ )
123
+
124
+ for result in response.results:
125
+ yield result
126
+
127
+ if not response.has_more:
128
+ return
129
+
130
+ params["next_token"] = response.next_token
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes