c2pa-python 0.32.13__tar.gz → 0.32.14__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.
Files changed (22) hide show
  1. {c2pa_python-0.32.13/src/c2pa_python.egg-info → c2pa_python-0.32.14}/PKG-INFO +1 -1
  2. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/pyproject.toml +1 -1
  3. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa/c2pa.py +25 -0
  4. {c2pa_python-0.32.13 → c2pa_python-0.32.14/src/c2pa_python.egg-info}/PKG-INFO +1 -1
  5. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/tests/test_unit_tests.py +13 -0
  6. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/LICENSE-APACHE +0 -0
  7. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/LICENSE-MIT +0 -0
  8. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/MANIFEST.in +0 -0
  9. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/README.md +0 -0
  10. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/requirements.txt +0 -0
  11. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/scripts/download_artifacts.py +0 -0
  12. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/setup.cfg +0 -0
  13. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/setup.py +0 -0
  14. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa/__init__.py +0 -0
  15. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa/build.py +0 -0
  16. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa/lib.py +0 -0
  17. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa_python.egg-info/SOURCES.txt +0 -0
  18. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa_python.egg-info/dependency_links.txt +0 -0
  19. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa_python.egg-info/entry_points.txt +0 -0
  20. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa_python.egg-info/requires.txt +0 -0
  21. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/src/c2pa_python.egg-info/top_level.txt +0 -0
  22. {c2pa_python-0.32.13 → c2pa_python-0.32.14}/tests/test_unit_tests_threaded.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: c2pa-python
3
- Version: 0.32.13
3
+ Version: 0.32.14
4
4
  Summary: Python bindings for the C2PA Content Authenticity Initiative (CAI) library
5
5
  Author-email: Gavin Peacock <gvnpeacock@adobe.com>, Tania Mathern <mathern@adobe.com>
6
6
  Maintainer-email: Gavin Peacock <gpeacock@adobe.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "c2pa-python"
7
- version = "0.32.13"
7
+ version = "0.32.14"
8
8
  requires-python = ">=3.10"
9
9
  description = "Python bindings for the C2PA Content Authenticity Initiative (CAI) library"
10
10
  readme = { file = "README.md", content-type = "text/markdown" }
@@ -48,6 +48,7 @@ _REQUIRED_FUNCTIONS = [
48
48
  'c2pa_reader_from_manifest_data_and_stream',
49
49
  'c2pa_reader_json',
50
50
  'c2pa_reader_detailed_json',
51
+ 'c2pa_reader_crjson',
51
52
  'c2pa_reader_resource_to_stream',
52
53
  'c2pa_reader_from_context',
53
54
  'c2pa_reader_with_stream',
@@ -561,6 +562,9 @@ _setup_function(
561
562
  _setup_function(
562
563
  _lib.c2pa_reader_detailed_json, [
563
564
  ctypes.POINTER(C2paReader)], ctypes.c_void_p)
565
+ _setup_function(
566
+ _lib.c2pa_reader_crjson, [
567
+ ctypes.POINTER(C2paReader)], ctypes.c_void_p)
564
568
  _setup_function(_lib.c2pa_reader_resource_to_stream, [ctypes.POINTER(
565
569
  C2paReader), ctypes.c_char_p, ctypes.POINTER(C2paStream)], ctypes.c_int64)
566
570
  _setup_function(
@@ -2631,6 +2635,27 @@ class Reader(ManagedResource):
2631
2635
 
2632
2636
  return _convert_to_py_string(result)
2633
2637
 
2638
+ def crjson(self) -> str:
2639
+ """Get the manifest store as a crJSON string.
2640
+
2641
+ crJSON is a standardized JSON format for C2PA manifest data. This
2642
+ call yields empty JSON ("{}") when there are no Content Credentials.
2643
+
2644
+ Returns:
2645
+ The manifest store as a crJSON string.
2646
+
2647
+ Raises:
2648
+ C2paError: If the Reader has been closed or the underlying C
2649
+ call returns null.
2650
+ """
2651
+
2652
+ self._ensure_valid_state()
2653
+
2654
+ result = _lib.c2pa_reader_crjson(self._handle)
2655
+ _check_ffi_operation_result(result, "Error parsing crJSON")
2656
+
2657
+ return _convert_to_py_string(result)
2658
+
2634
2659
  def _get_manifest_field(self, extractor):
2635
2660
  """Extract a field from (cached) manifest data, or None if unavailable.
2636
2661
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: c2pa-python
3
- Version: 0.32.13
3
+ Version: 0.32.14
4
4
  Summary: Python bindings for the C2PA Content Authenticity Initiative (CAI) library
5
5
  Author-email: Gavin Peacock <gvnpeacock@adobe.com>, Tania Mathern <mathern@adobe.com>
6
6
  Maintainer-email: Gavin Peacock <gpeacock@adobe.com>
@@ -271,6 +271,19 @@ class TestReader(unittest.TestCase):
271
271
  title = manifest_store["manifests"][manifest_store["active_manifest"]]["claim"]["dc:title"]
272
272
  self.assertEqual(title, DEFAULT_TEST_FILE_NAME)
273
273
 
274
+ def test_stream_read_crjson_and_parse(self):
275
+ with open(self.testPath, "rb") as file:
276
+ reader = Reader("image/jpeg", file)
277
+ crjson = reader.crjson()
278
+ self.assertTrue(crjson)
279
+ json.loads(crjson)
280
+
281
+ def test_stream_read_crjson_path_only(self):
282
+ with Reader(self.testPath) as reader:
283
+ crjson = reader.crjson()
284
+ self.assertTrue(crjson)
285
+ json.loads(crjson)
286
+
274
287
  def test_stream_read_string_stream_path_only(self):
275
288
  with Reader(self.testPath) as reader:
276
289
  json_data = reader.json()
File without changes
File without changes
File without changes
File without changes
File without changes