authentasdk 0.2.4__tar.gz → 0.2.5__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,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: authentasdk
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Python SDK for the Authenta API to detect deepfakes and manipulated media
5
5
  Home-page: https://github.com/phospheneai/authenta-python-sdk
6
6
  Author: Arjun Adhithya
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = authentasdk
3
- version = 0.2.4
3
+ version = 0.2.5
4
4
  description = Python SDK for the Authenta API to detect deepfakes and manipulated media
5
5
  author = Arjun Adhithya
6
6
  author_email = rrarjunadhithya@gmail.com
@@ -295,6 +295,33 @@ class AuthentaClient:
295
295
  raise RuntimeError("No 'mid' in upload response")
296
296
  return self.wait_for_media(mid, interval=interval, timeout=timeout)
297
297
 
298
+ def get_result(self, media: Dict[str, Any]) -> Dict[str, Any]:
299
+ """
300
+ Fetch the detection result JSON from the media's resultURL.
301
+
302
+ The resultURL is a presigned S3 URL returned after processing.
303
+ It contains the actual detection output (e.g. isLiveness, isDeepFake,
304
+ isSimilar, similarityScore, etc.).
305
+
306
+ Args:
307
+ media: A media dict returned by face_intelligence(), process(), or
308
+ wait_for_media() — must contain a 'resultURL' key.
309
+
310
+ Returns:
311
+ Parsed detection result dict from resultURL.
312
+
313
+ Raises:
314
+ ValueError: If the media dict has no resultURL.
315
+ RuntimeError: If the resultURL fetch fails.
316
+ """
317
+ result_url = media.get("resultURL")
318
+ if not result_url:
319
+ raise ValueError("media dict has no 'resultURL'. Ensure processing is complete (status=PROCESSED).")
320
+ resp = requests.get(result_url, timeout=30)
321
+ if not resp.ok:
322
+ raise RuntimeError(f"Failed to fetch resultURL: HTTP {resp.status_code}")
323
+ return resp.json()
324
+
298
325
  def face_intelligence(
299
326
  self,
300
327
  path: str,
@@ -312,6 +339,7 @@ class AuthentaClient:
312
339
  High-level helper for Face Integrity (FI) model:
313
340
  1) upload_file(path, model_type) -> get mid
314
341
  2) wait_for_media(mid) (only if auto_polling=True)
342
+ 3) get_result(media) to fetch detection output (only if auto_polling=True)
315
343
 
316
344
  Args:
317
345
  path: Local path to the media file.
@@ -321,13 +349,16 @@ class AuthentaClient:
321
349
  faceswapCheck: Whether to check for face swapping (video only).
322
350
  livenessCheck: Whether to check for liveness.
323
351
  faceSimilarityCheck: Whether to check for face similarity (image only).
324
- auto_polling: If True (default), blocks until processing completes.
352
+ auto_polling: If True (default), blocks until processing completes and
353
+ automatically fetches the detection result from resultURL, merging
354
+ it into the returned dict under the key 'result'.
325
355
  If False, returns immediately after upload with initial metadata.
326
356
  interval: Polling interval in seconds (used only when auto_polling=True).
327
357
  timeout: Timeout in seconds (used only when auto_polling=True).
328
358
 
329
359
  Returns:
330
- If auto_polling=True: the final processed media JSON.
360
+ If auto_polling=True: media dict with an added 'result' key containing
361
+ the full detection output fetched from resultURL.
331
362
  If auto_polling=False: the initial upload metadata dict (includes 'mid').
332
363
  """
333
364
  if self._content_type(path).startswith("image/") and faceswapCheck:
@@ -351,7 +382,9 @@ class AuthentaClient:
351
382
  mid = meta.get("mid")
352
383
  if not mid:
353
384
  raise RuntimeError("No 'mid' in upload response")
354
- return self.wait_for_media(mid, interval=interval, timeout=timeout)
385
+ media = self.wait_for_media(mid, interval=interval, timeout=timeout)
386
+ media["result"] = self.get_result(media)
387
+ return media
355
388
 
356
389
  def delete_media(self, mid: str) -> None:
357
390
  """DELETE /api/media/{mid}: delete a media record."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: authentasdk
3
- Version: 0.2.4
3
+ Version: 0.2.5
4
4
  Summary: Python SDK for the Authenta API to detect deepfakes and manipulated media
5
5
  Home-page: https://github.com/phospheneai/authenta-python-sdk
6
6
  Author: Arjun Adhithya
File without changes
File without changes