infisicalsdk 1.0.10__py3-none-any.whl → 1.0.12__py3-none-any.whl

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.

Potentially problematic release.


This version of infisicalsdk might be problematic. Click here for more details.

@@ -194,3 +194,102 @@ class KmsKeyEncryptDataResponse(BaseModel):
194
194
  class KmsKeyDecryptDataResponse(BaseModel):
195
195
  """Response model for decrypt data API"""
196
196
  plaintext: str
197
+
198
+ @dataclass
199
+ class CreateFolderResponseItem(BaseModel):
200
+ """Folder model with path for create response"""
201
+ id: str
202
+ name: str
203
+ createdAt: str
204
+ updatedAt: str
205
+ envId: str
206
+ path: str
207
+ version: Optional[int] = 1
208
+ parentId: Optional[str] = None
209
+ isReserved: Optional[bool] = False
210
+ description: Optional[str] = None
211
+ lastSecretModified: Optional[str] = None
212
+
213
+ @dataclass
214
+ class CreateFolderResponse(BaseModel):
215
+ """Response model for create folder API"""
216
+ folder: CreateFolderResponseItem
217
+
218
+ @classmethod
219
+ def from_dict(cls, data: Dict) -> 'CreateFolderResponse':
220
+ return cls(
221
+ folder=CreateFolderResponseItem.from_dict(data['folder']),
222
+ )
223
+
224
+
225
+ @dataclass
226
+ class ListFoldersResponseItem(BaseModel):
227
+ """Response model for list folders API"""
228
+ id: str
229
+ name: str
230
+ createdAt: str
231
+ updatedAt: str
232
+ envId: str
233
+ version: Optional[int] = 1
234
+ parentId: Optional[str] = None
235
+ isReserved: Optional[bool] = False
236
+ description: Optional[str] = None
237
+ lastSecretModified: Optional[str] = None
238
+ relativePath: Optional[str] = None
239
+
240
+
241
+ @dataclass
242
+ class ListFoldersResponse(BaseModel):
243
+ """Complete response model for folders API"""
244
+ folders: List[ListFoldersResponseItem]
245
+
246
+ @classmethod
247
+ def from_dict(cls, data: Dict) -> 'ListFoldersResponse':
248
+ """Create model from dictionary with camelCase keys, handling nested objects"""
249
+ return cls(
250
+ folders=[ListFoldersResponseItem.from_dict(folder) for folder in data['folders']]
251
+ )
252
+
253
+
254
+ @dataclass
255
+ class Environment(BaseModel):
256
+ """Environment model"""
257
+ envId: str
258
+ envName: str
259
+ envSlug: str
260
+
261
+ @dataclass
262
+ class SingleFolderResponseItem(BaseModel):
263
+ """Response model for get folder API"""
264
+ id: str
265
+ name: str
266
+ createdAt: str
267
+ updatedAt: str
268
+ envId: str
269
+ path: str
270
+ projectId: str
271
+ environment: Environment
272
+ version: Optional[int] = 1
273
+ parentId: Optional[str] = None
274
+ isReserved: Optional[bool] = False
275
+ description: Optional[str] = None
276
+ lastSecretModified: Optional[str] = None
277
+
278
+ @classmethod
279
+ def from_dict(cls, data: Dict) -> 'SingleFolderResponseItem':
280
+ """Create model from dictionary with nested Environment"""
281
+ folder_data = data.copy()
282
+ folder_data['environment'] = Environment.from_dict(data['environment'])
283
+
284
+ return super().from_dict(folder_data)
285
+
286
+ @dataclass
287
+ class SingleFolderResponse(BaseModel):
288
+ """Response model for get/create folder API"""
289
+ folder: SingleFolderResponseItem
290
+
291
+ @classmethod
292
+ def from_dict(cls, data: Dict) -> 'SingleFolderResponse':
293
+ return cls(
294
+ folder=SingleFolderResponseItem.from_dict(data['folder']),
295
+ )
infisical_sdk/client.py CHANGED
@@ -3,6 +3,7 @@ from .infisical_requests import InfisicalRequests
3
3
  from infisical_sdk.resources import Auth
4
4
  from infisical_sdk.resources import V3RawSecrets
5
5
  from infisical_sdk.resources import KMS
6
+ from infisical_sdk.resources import V2Folders
6
7
 
7
8
  from infisical_sdk.util import SecretsCache
8
9
 
@@ -24,6 +25,7 @@ class InfisicalSDKClient:
24
25
  self.auth = Auth(self.api, self.set_token)
25
26
  self.secrets = V3RawSecrets(self.api, self.cache)
26
27
  self.kms = KMS(self.api)
28
+ self.folders = V2Folders(self.api)
27
29
 
28
30
  def set_token(self, token: str):
29
31
  """
@@ -1,3 +1,4 @@
1
1
  from .secrets import V3RawSecrets
2
2
  from .kms import KMS
3
- from .auth import Auth
3
+ from .auth import Auth
4
+ from .folders import V2Folders
@@ -0,0 +1,75 @@
1
+ from typing import Optional
2
+ from datetime import datetime, timezone
3
+
4
+ from infisical_sdk.infisical_requests import InfisicalRequests
5
+ from infisical_sdk.api_types import ListFoldersResponse, SingleFolderResponse, SingleFolderResponseItem, CreateFolderResponse, CreateFolderResponseItem
6
+
7
+
8
+ class V2Folders:
9
+ def __init__(self, requests: InfisicalRequests) -> None:
10
+ self.requests = requests
11
+
12
+ def create_folder(
13
+ self,
14
+ name: str,
15
+ environment_slug: str,
16
+ project_id: str,
17
+ path: str = "/",
18
+ description: Optional[str] = None) -> CreateFolderResponseItem:
19
+
20
+ request_body = {
21
+ "projectId": project_id,
22
+ "environment": environment_slug,
23
+ "name": name,
24
+ "path": path,
25
+ "description": description,
26
+ }
27
+
28
+ result = self.requests.post(
29
+ path="/api/v2/folders",
30
+ json=request_body,
31
+ model=CreateFolderResponse
32
+ )
33
+
34
+ return result.data.folder
35
+
36
+ def list_folders(
37
+ self,
38
+ project_id: str,
39
+ environment_slug: str,
40
+ path: str,
41
+ last_secret_modified: Optional[datetime] = None,
42
+ recursive: bool = False) -> ListFoldersResponse:
43
+
44
+ params = {
45
+ "projectId": project_id,
46
+ "environment": environment_slug,
47
+ "path": path,
48
+ "recursive": recursive,
49
+ }
50
+
51
+ if last_secret_modified is not None:
52
+ # Convert to UTC and format as RFC 3339 with 'Z' suffix
53
+ # The API expects UTC times in 'Z' format (e.g., 2023-11-07T05:31:56Z)
54
+ utc_datetime = last_secret_modified.astimezone(timezone.utc) if last_secret_modified.tzinfo else last_secret_modified.replace(tzinfo=timezone.utc)
55
+ params["lastSecretModified"] = utc_datetime.strftime('%Y-%m-%dT%H:%M:%SZ')
56
+
57
+ result = self.requests.get(
58
+ path="/api/v2/folders",
59
+ params=params,
60
+ model=ListFoldersResponse
61
+ )
62
+
63
+ return result.data
64
+
65
+ def get_folder_by_id(
66
+ self,
67
+ id: str) -> SingleFolderResponseItem:
68
+
69
+ result = self.requests.get(
70
+ path=f"/api/v2/folders/{id}",
71
+ model=SingleFolderResponse
72
+ )
73
+
74
+ return result.data.folder
75
+
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: infisicalsdk
3
- Version: 1.0.10
4
- Summary: Infisical API Client
3
+ Version: 1.0.12
4
+ Summary: Official Infisical SDK for Python (Latest)
5
5
  Home-page: https://github.com/Infisical/python-sdk-official
6
6
  Author: Infisical
7
7
  Author-email: support@infisical.com
8
- Keywords: Infisical,Infisical API,Infisical SDK
8
+ Keywords: Infisical,Infisical API,Infisical SDK,SDK,Secrets Management
9
9
  Description-Content-Type: text/markdown
10
+ License-File: LICENSE
10
11
  Requires-Dist: python-dateutil
11
12
  Requires-Dist: aenum
12
13
  Requires-Dist: requests~=2.32
@@ -18,8 +19,10 @@ Dynamic: description
18
19
  Dynamic: description-content-type
19
20
  Dynamic: home-page
20
21
  Dynamic: keywords
22
+ Dynamic: license-file
21
23
  Dynamic: requires-dist
22
24
  Dynamic: summary
23
25
 
24
- Infisical SDK client for Python. To view documentation, please visit https://github.com/Infisical/python-sdk-official
26
+ The official Infisical SDK for Python.
27
+ Documentation can be found at https://github.com/Infisical/python-sdk-official
25
28
 
@@ -1,9 +1,10 @@
1
1
  infisical_sdk/__init__.py,sha256=AVQAg_FAQtrofgDpLBXTAas_2j9Fi1n0FXzKyclde5U,204
2
- infisical_sdk/api_types.py,sha256=-SFKKhDx0GZGlzZ0kysvEMmBRtbQQXl5vwaH1a4m1Ac,5170
3
- infisical_sdk/client.py,sha256=8ElPok-Ao54NgX1bQtWX7ccM7UTvVhXoaWan1iRwc9k,1505
2
+ infisical_sdk/api_types.py,sha256=d4Df2spEIFr8TaarhG_GCmYfn7w8zSEHPVelys1MUPU,7910
3
+ infisical_sdk/client.py,sha256=GZq4HKH0AzP-FZbyuIUZKM3YEEKJoBau7_OOg9YKmG4,1594
4
4
  infisical_sdk/infisical_requests.py,sha256=v6GMakywaHbiGV2aZ4oiDsDukHt50PhA1J2xAgNGxMk,7666
5
- infisical_sdk/resources/__init__.py,sha256=oq3gcsEqybe0O44wPyoaiRj3TrzaP4X5APJeI4ltPwo,77
5
+ infisical_sdk/resources/__init__.py,sha256=No7TdtXPrAY5yjzbP9PyVhhlxsPxbtdEeyaZAC2jihg,108
6
6
  infisical_sdk/resources/auth.py,sha256=YXzWbrH4ibIXwfqTy453dmqX7PpowbLukok0Yl7jaKg,569
7
+ infisical_sdk/resources/folders.py,sha256=1V2871WaM61LcYvto0o1u3Y-grjRPJGBb1BOCfaZfrE,2332
7
8
  infisical_sdk/resources/kms.py,sha256=4nTXDo3qW5Qk1o1M4K8UG98fgxHoEGm0QkOEUv2SuTc,4712
8
9
  infisical_sdk/resources/secrets.py,sha256=KJyBbPLxZRs5S6Ig6CbuDLAI07eO1OFbaB5WXrQoFVI,9219
9
10
  infisical_sdk/resources/auth_methods/__init__.py,sha256=DHsGPBvdUvifNbwEIVyW7YQSVv0KJIcwpG78xXuJxZk,104
@@ -12,7 +13,8 @@ infisical_sdk/resources/auth_methods/oidc_auth.py,sha256=5X8md8VgYGaC-5jLh22eTnA
12
13
  infisical_sdk/resources/auth_methods/universal_auth.py,sha256=K5u25c344y82RZatjnDEf619XiiGQBgUS-Aia041hZE,1088
13
14
  infisical_sdk/util/__init__.py,sha256=nPGrsq3vGWfwakfvSs7tzOfztXY16DS5GahTiyrC8tE,39
14
15
  infisical_sdk/util/secrets_cache.py,sha256=LmgxFZEy8194xe4YhA958BJQdcV0Fv2Xmhfc7bwvBfQ,3175
15
- infisicalsdk-1.0.10.dist-info/METADATA,sha256=oDjywjEWyZ2WM3Tv80iWbBbN7YAPXlm3ko1zFq0QzZE,726
16
- infisicalsdk-1.0.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
17
- infisicalsdk-1.0.10.dist-info/top_level.txt,sha256=FvJjMGD1FvxwipO_qFajdH20yNV8n3lJ7G3DkQoPJNU,14
18
- infisicalsdk-1.0.10.dist-info/RECORD,,
16
+ infisicalsdk-1.0.12.dist-info/licenses/LICENSE,sha256=nLlhW2T03TmLSRQAC60jXyRwB6JK4CZmsSLWhxG6gt4,1438
17
+ infisicalsdk-1.0.12.dist-info/METADATA,sha256=vCMLz6rQkDFoTsZzz_cBi04Eo3QlSKTqm27BmwCjH_I,819
18
+ infisicalsdk-1.0.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ infisicalsdk-1.0.12.dist-info/top_level.txt,sha256=FvJjMGD1FvxwipO_qFajdH20yNV8n3lJ7G3DkQoPJNU,14
20
+ infisicalsdk-1.0.12.dist-info/RECORD,,
@@ -0,0 +1,11 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Infisical
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
+
11
+ NOTE: This license pertains specifically to components of the codebase that do not possess an explicit license. Each distinct SDK incorporated within this software is governed by its individual licensing terms and conditions. The provisions outlined in this MIT license are applicable to those segments of the codebase not explicitly covered by their respective licenses.