This is an automated email from the ASF dual-hosted git repository.

Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new c5a3e41666 feat(bindings/python): expose WriteOptions expires and 
content_language (#9418)
c5a3e41666 is described below

commit c5a3e41666e3e486fbdef68798a4b02456930477
Author: Chitral Verma <[email protected]>
AuthorDate: Mon Nov 30 10:52:24 2026 +0530

    feat(bindings/python): expose WriteOptions expires and content_language 
(#9418)
    
    * feat(bindings/python): expose WriteOptions expires and content_language
    
    Add keyword-only content_language and expires arguments to
    Operator.write and AsyncOperator.write, generated from core
    WriteOptions. open() accepts both in write modes. Read modes raise
    TypeError for both unless the value is None.
    
    expires takes a datetime.timedelta, the type that the default_ttl
    config it overrides takes. presign_write does not take either field.
    
    The docstrings come from core. A Metadata::x code span now reads as
    Metadata.x, the property that stat() returns.
    
    Signed-off-by: Chitral Verma <[email protected]>
    
    * fix(bindings/python): check expires pass-through without waiting for 
expiry
    
    Core behavior tests already check that writes expire. The binding tests
    now check that write() and open() pass expires to core: a positive value
    writes, and zero raises ConfigInvalid from write() and from close(). No
    test waits for a TTL.
    
    The open() TypeError docs now name a value that an option cannot take,
    such as a negative expires.
    
    Signed-off-by: Chitral Verma <[email protected]>
    
    * fix(bindings/python): accept None for expires and content_language in 
WriteKwargs
    
    open() takes **kwargs: Unpack[OpenKwargs], and OpenKwargs inherits
    WriteKwargs. The runtime and the write() stubs accept None for both
    options, but the WriteKwargs types did not, so mypy and pyright rejected
    open(..., expires=ttl) with an optional ttl.
    
    Render both types with | None. A KWARGS_ACCEPT_NONE entry that names no
    generated keyword argument fails generation. The typing test covers the
    sync and async open() calls.
    
    Signed-off-by: Chitral Verma <[email protected]>
    
    ---------
    
    Signed-off-by: Chitral Verma <[email protected]>
---
 bindings/python/python/opendal/operator.pyi |  44 +++++--
 bindings/python/python/opendal/options.py   |  25 +++-
 bindings/python/src/operator.rs             |  50 ++++++--
 bindings/python/src/options.rs              |   2 +
 bindings/python/src/options/generated.rs    |  23 +++-
 bindings/python/tests/test_open_modes.py    |   7 ++
 bindings/python/tests/test_write.py         | 104 +++++++++++++++-
 bindings/python/tests/typing/from_config.py |  14 +++
 dev/src/generate/python.rs                  | 186 ++++++++++++++++++++++++----
 9 files changed, 397 insertions(+), 58 deletions(-)

diff --git a/bindings/python/python/opendal/operator.pyi 
b/bindings/python/python/opendal/operator.pyi
index 144d1afee7..240bfb91d8 100644
--- a/bindings/python/python/opendal/operator.pyi
+++ b/bindings/python/python/opendal/operator.pyi
@@ -16,7 +16,7 @@
 # under the License.
 
 import collections.abc
-from datetime import datetime
+from datetime import datetime, timedelta
 from os import PathLike
 from typing import Any, SupportsIndex, final
 
@@ -376,8 +376,8 @@ class AsyncOperator:
         ------
         TypeError
             If `**kwargs` contains an unknown keyword argument, an option with 
a
-            non-`None` value that does not apply to `mode`, or a value with an
-            incompatible type.
+            non-`None` value that does not apply to `mode`, or a value that the
+            option cannot take, such as a negative `chunk` or `expires`.
         ValueError
             If the mode is invalid or unsupported, including text (`"t"`) and
             update (`"+"`) modes, or if the mode conflicts with `append` or
@@ -791,10 +791,12 @@ class AsyncOperator:
         content_type: str | None = None,
         content_disposition: str | None = None,
         content_encoding: str | None = None,
+        content_language: str | None = None,
         if_match: str | None = None,
         if_none_match: str | None = None,
         if_not_exists: bool | None = None,
         user_metadata: dict[str, str] | None = None,
+        expires: timedelta | None = None,
         checksum: ChecksumAlgorithm | None = None,
     ) -> collections.abc.Awaitable[None]:
         """
@@ -825,6 +827,8 @@ class AsyncOperator:
             The content disposition header to set on the file.
         content_encoding : str, optional
             The content encoding header to set on the file.
+        content_language : str, optional
+            The content language to set on the file, such as `fr-CA, en`.
         if_match : str, optional
             The ETag to match when writing the file.
         if_none_match : str, optional
@@ -833,6 +837,9 @@ class AsyncOperator:
             Whether to fail if the file already exists.
         user_metadata : dict, optional
             The user metadata to set on the file.
+        expires : datetime.timedelta, optional
+            How long the file lives after the write commits. It overrides the
+            service's default TTL.
         checksum : ChecksumAlgorithm | None, optional
             The algorithm the service uses to verify the full object before
             committing. Omit it or pass `None` to use the service default.
@@ -840,13 +847,15 @@ class AsyncOperator:
         Raises
         ------
         ValueError
-            If the checksum name is unrecognized.
+            If the checksum name is unrecognized, or if `expires` is negative.
+        ConfigInvalid
+            If `expires` is zero or too large for the service.
         ConditionNotMatch
             If `if_match`, `if_none_match`, or `if_not_exists` fails.
         Unsupported
-            If the service does not support `append`, a requested condition, or
-            the selected checksum algorithm. Append writes cannot request a
-            checksum.
+            If the service does not support `append`, `expires`, a requested
+            condition, or the selected checksum algorithm. Append writes cannot
+            request a checksum.
         ChecksumMismatch
             If the checksum fails verification.
 
@@ -1171,8 +1180,8 @@ class Operator:
         ------
         TypeError
             If `**kwargs` contains an unknown keyword argument, an option with 
a
-            non-`None` value that does not apply to `mode`, or a value with an
-            incompatible type.
+            non-`None` value that does not apply to `mode`, or a value that the
+            option cannot take, such as a negative `chunk` or `expires`.
         ValueError
             If the mode is invalid or unsupported, including text (`"t"`) and
             update (`"+"`) modes, or if the mode conflicts with `append` or
@@ -1413,10 +1422,12 @@ class Operator:
         content_type: str | None = None,
         content_disposition: str | None = None,
         content_encoding: str | None = None,
+        content_language: str | None = None,
         if_match: str | None = None,
         if_none_match: str | None = None,
         if_not_exists: bool | None = None,
         user_metadata: dict[str, str] | None = None,
+        expires: timedelta | None = None,
         checksum: ChecksumAlgorithm | None = None,
     ) -> None:
         """
@@ -1447,6 +1458,8 @@ class Operator:
             The content disposition header to set on the file.
         content_encoding : str, optional
             The content encoding header to set on the file.
+        content_language : str, optional
+            The content language to set on the file, such as `fr-CA, en`.
         if_match : str, optional
             The ETag to match when writing the file.
         if_none_match : str, optional
@@ -1455,6 +1468,9 @@ class Operator:
             Whether to fail if the file already exists.
         user_metadata : dict, optional
             The user metadata to set on the file.
+        expires : datetime.timedelta, optional
+            How long the file lives after the write commits. It overrides the
+            service's default TTL.
         checksum : ChecksumAlgorithm | None, optional
             The algorithm the service uses to verify the full object before
             committing. Omit it or pass `None` to use the service default.
@@ -1462,13 +1478,15 @@ class Operator:
         Raises
         ------
         ValueError
-            If the checksum name is unrecognized.
+            If the checksum name is unrecognized, or if `expires` is negative.
+        ConfigInvalid
+            If `expires` is zero or too large for the service.
         ConditionNotMatch
             If `if_match`, `if_none_match`, or `if_not_exists` fails.
         Unsupported
-            If the service does not support `append`, a requested condition, or
-            the selected checksum algorithm. Append writes cannot request a
-            checksum.
+            If the service does not support `append`, `expires`, a requested
+            condition, or the selected checksum algorithm. Append writes cannot
+            request a checksum.
         ChecksumMismatch
             If the checksum fails verification.
         """
diff --git a/bindings/python/python/opendal/options.py 
b/bindings/python/python/opendal/options.py
index 9526112735..824974b921 100644
--- a/bindings/python/python/opendal/options.py
+++ b/bindings/python/python/opendal/options.py
@@ -42,7 +42,7 @@ method's keyword arguments.
 
 from __future__ import annotations
 
-from datetime import datetime
+from datetime import datetime, timedelta
 from typing import Literal, TypeAlias, TypedDict
 
 ChecksumAlgorithm: TypeAlias = Literal[
@@ -391,6 +391,14 @@ class WriteKwargs(TypedDict, total=False):
 
     This operation allows specifying the encoding applied to the content being 
written.
     """
+    content_language: str | None
+    """Sets Content-Language system metadata on the object being written.
+
+    Use a language tag or a comma-separated list of tags, such as `fr-CA, en`.
+    Check `op.capability().write_with_content_language` for support. A
+    subsequent stat can retrieve the stored value with 
`Metadata.content_language`.
+    Services without support may ignore this option.
+    """
     if_match: str
     """Write only when the file at the write path has this exact ETag.
 
@@ -454,6 +462,17 @@ class WriteKwargs(TypedDict, total=False):
     A later `stat()` returns this metadata as `user_metadata` when the
     service exposes user metadata.
     """
+    expires: timedelta | None
+    """Sets how long the new file lives after the write commits.
+
+    A supplied duration overrides the service's default TTL. When unset,
+    the service uses its usual expiration policy. Services round positive
+    durations up to their supported precision.
+
+    Raises `opendal.exceptions.Unsupported` when the service does not
+    advertise `op.capability().write_with_expires`. A zero or
+    unrepresentable duration raises `opendal.exceptions.ConfigInvalid`.
+    """
     checksum: ChecksumAlgorithm | None
     """The algorithm the service uses to verify the full object before 
committing.
     `None` preserves the service default.
@@ -756,8 +775,8 @@ class OpenKwargs(ReadKwargs, WriteKwargs, total=False):
     In write, append, and create modes, `open()` sets `chunk` to 256 KiB when
     `chunk` is unset or `0` and the service has no
     `op.capability().write_multi_min_size`. `open()` raises
-    `opendal.exceptions.Unsupported` for appending, a condition, or a
-    `checksum` that the service does not support. Errors while writing
+    `opendal.exceptions.Unsupported` for appending, a condition, `expires`,
+    or a `checksum` that the service does not support. Errors while writing
     surface from the file: its `write()`, and the `flush()` of a file from
     `Operator.open`, raise `opendal.exceptions.ConditionNotMatch` for a failed
     condition and `OSError` for any other error, while `close()` raises each
diff --git a/bindings/python/src/operator.rs b/bindings/python/src/operator.rs
index 62b7ddcf41..855f14635a 100644
--- a/bindings/python/src/operator.rs
+++ b/bindings/python/src/operator.rs
@@ -578,8 +578,8 @@ impl Operator {
     /// ------
     /// TypeError
     ///     If `**kwargs` contains an unknown keyword argument, an option with 
a
-    ///     non-`None` value that does not apply to `mode`, or a value with an
-    ///     incompatible type.
+    ///     non-`None` value that does not apply to `mode`, or a value that the
+    ///     option cannot take, such as a negative `chunk` or `expires`.
     /// ValueError
     ///     If the mode is invalid or unsupported, including text (`"t"`) and
     ///     update (`"+"`) modes, or if the mode conflicts with `append` or
@@ -806,6 +806,8 @@ impl Operator {
     ///     The content disposition header to set on the file.
     /// content_encoding : str, optional
     ///     The content encoding header to set on the file.
+    /// content_language : str, optional
+    ///     The content language to set on the file, such as `fr-CA, en`.
     /// if_match : str, optional
     ///     The ETag to match when writing the file.
     /// if_none_match : str, optional
@@ -814,6 +816,9 @@ impl Operator {
     ///     Whether to fail if the file already exists.
     /// user_metadata : dict, optional
     ///     The user metadata to set on the file.
+    /// expires : datetime.timedelta, optional
+    ///     How long the file lives after the write commits. It overrides the
+    ///     service's default TTL.
     /// checksum : ChecksumAlgorithm | None, optional
     ///     The algorithm the service uses to verify the full object before
     ///     committing. Omit it or pass `None` to use the service default.
@@ -821,13 +826,15 @@ impl Operator {
     /// Raises
     /// ------
     /// ValueError
-    ///     If the checksum name is unrecognized.
+    ///     If the checksum name is unrecognized, or if `expires` is negative.
+    /// ConfigInvalid
+    ///     If `expires` is zero or too large for the service.
     /// ConditionNotMatch
     ///     If `if_match`, `if_none_match`, or `if_not_exists` fails.
     /// Unsupported
-    ///     If the service does not support `append`, a requested condition, or
-    ///     the selected checksum algorithm. Append writes cannot request a
-    ///     checksum.
+    ///     If the service does not support `append`, `expires`, a requested
+    ///     condition, or the selected checksum algorithm. Append writes cannot
+    ///     request a checksum.
     /// ChecksumMismatch
     ///     If the checksum fails verification.
     #[allow(clippy::too_many_arguments)]
@@ -839,10 +846,12 @@ impl Operator {
         content_type = None,
         content_disposition = None,
         content_encoding = None,
+        content_language = None,
         if_match = None,
         if_none_match = None,
         if_not_exists = None,
         user_metadata = None,
+        expires = None,
         checksum: "ChecksumAlgorithm | None" = None))]
     pub fn write(
         &self,
@@ -856,10 +865,12 @@ impl Operator {
         content_type: Option<String>,
         content_disposition: Option<String>,
         content_encoding: Option<String>,
+        content_language: Option<String>,
         if_match: Option<String>,
         if_none_match: Option<String>,
         if_not_exists: Option<bool>,
         user_metadata: Option<HashMap<String, String>>,
+        expires: Option<Duration>,
         checksum: Option<&str>,
     ) -> PyResult<()> {
         let path = path.to_string_lossy().to_string();
@@ -872,10 +883,12 @@ impl Operator {
             content_type,
             content_disposition,
             content_encoding,
+            content_language,
             if_match,
             if_none_match,
             if_not_exists,
             user_metadata,
+            expires,
             checksum: checksum.map(parse_checksum_algorithm).transpose()?,
         };
 
@@ -1540,8 +1553,8 @@ impl AsyncOperator {
     /// ------
     /// TypeError
     ///     If `**kwargs` contains an unknown keyword argument, an option with 
a
-    ///     non-`None` value that does not apply to `mode`, or a value with an
-    ///     incompatible type.
+    ///     non-`None` value that does not apply to `mode`, or a value that the
+    ///     option cannot take, such as a negative `chunk` or `expires`.
     /// ValueError
     ///     If the mode is invalid or unsupported, including text (`"t"`) and
     ///     update (`"+"`) modes, or if the mode conflicts with `append` or
@@ -1769,6 +1782,8 @@ impl AsyncOperator {
     ///     The content disposition header to set on the file.
     /// content_encoding : str, optional
     ///     The content encoding header to set on the file.
+    /// content_language : str, optional
+    ///     The content language to set on the file, such as `fr-CA, en`.
     /// if_match : str, optional
     ///     The ETag to match when writing the file.
     /// if_none_match : str, optional
@@ -1777,6 +1792,9 @@ impl AsyncOperator {
     ///     Whether to fail if the file already exists.
     /// user_metadata : dict, optional
     ///     The user metadata to set on the file.
+    /// expires : datetime.timedelta, optional
+    ///     How long the file lives after the write commits. It overrides the
+    ///     service's default TTL.
     /// checksum : ChecksumAlgorithm | None, optional
     ///     The algorithm the service uses to verify the full object before
     ///     committing. Omit it or pass `None` to use the service default.
@@ -1784,13 +1802,15 @@ impl AsyncOperator {
     /// Raises
     /// ------
     /// ValueError
-    ///     If the checksum name is unrecognized.
+    ///     If the checksum name is unrecognized, or if `expires` is negative.
+    /// ConfigInvalid
+    ///     If `expires` is zero or too large for the service.
     /// ConditionNotMatch
     ///     If `if_match`, `if_none_match`, or `if_not_exists` fails.
     /// Unsupported
-    ///     If the service does not support `append`, a requested condition, or
-    ///     the selected checksum algorithm. Append writes cannot request a
-    ///     checksum.
+    ///     If the service does not support `append`, `expires`, a requested
+    ///     condition, or the selected checksum algorithm. Append writes cannot
+    ///     request a checksum.
     /// ChecksumMismatch
     ///     If the checksum fails verification.
     ///
@@ -1807,10 +1827,12 @@ impl AsyncOperator {
         content_type = None,
         content_disposition = None,
         content_encoding = None,
+        content_language = None,
         if_match = None,
         if_none_match = None,
         if_not_exists = None,
         user_metadata = None,
+        expires = None,
         checksum: "ChecksumAlgorithm | None" = None) -> 
"collections.abc.Awaitable[None]")]
     pub fn write<'p>(
         &'p self,
@@ -1824,10 +1846,12 @@ impl AsyncOperator {
         content_type: Option<String>,
         content_disposition: Option<String>,
         content_encoding: Option<String>,
+        content_language: Option<String>,
         if_match: Option<String>,
         if_none_match: Option<String>,
         if_not_exists: Option<bool>,
         user_metadata: Option<HashMap<String, String>>,
+        expires: Option<Duration>,
         checksum: Option<&str>,
     ) -> PyResult<Bound<'p, PyAny>> {
         let opts = WriteOptions {
@@ -1838,10 +1862,12 @@ impl AsyncOperator {
             content_type,
             content_disposition,
             content_encoding,
+            content_language,
             if_match,
             if_none_match,
             if_not_exists,
             user_metadata,
+            expires,
             checksum: checksum.map(parse_checksum_algorithm).transpose()?,
         };
         let this = self.core.clone();
diff --git a/bindings/python/src/options.rs b/bindings/python/src/options.rs
index 3d12ef5ce3..530f5c0224 100644
--- a/bindings/python/src/options.rs
+++ b/bindings/python/src/options.rs
@@ -93,10 +93,12 @@ const WRITE_OPTION_KEYS: &[&str] = &[
     "content_type",
     "content_disposition",
     "content_encoding",
+    "content_language",
     "if_match",
     "if_none_match",
     "if_not_exists",
     "user_metadata",
+    "expires",
     "checksum",
 ];
 
diff --git a/bindings/python/src/options/generated.rs 
b/bindings/python/src/options/generated.rs
index 929a74913a..8ad89b5fcc 100644
--- a/bindings/python/src/options/generated.rs
+++ b/bindings/python/src/options/generated.rs
@@ -691,6 +691,13 @@ pub struct WriteOptions {
     ///
     /// This operation allows specifying the encoding applied to the content 
being written.
     pub content_encoding: Option<String>,
+    /// Sets Content-Language system metadata on the object being written.
+    ///
+    /// Use a language tag or a comma-separated list of tags, such as `fr-CA, 
en`.
+    /// Check `op.capability().write_with_content_language` for support. A
+    /// subsequent stat can retrieve the stored value with 
`Metadata.content_language`.
+    /// Services without support may ignore this option.
+    pub content_language: Option<String>,
     /// Write only when the file at the write path has this exact ETag.
     ///
     /// The condition succeeds when the file exists and its ETag equals this
@@ -750,6 +757,16 @@ pub struct WriteOptions {
     /// A later `stat()` returns this metadata as `user_metadata` when the
     /// service exposes user metadata.
     pub user_metadata: Option<std::collections::HashMap<String, String>>,
+    /// Sets how long the new file lives after the write commits.
+    ///
+    /// A supplied duration overrides the service's default TTL. When unset,
+    /// the service uses its usual expiration policy. Services round positive
+    /// durations up to their supported precision.
+    ///
+    /// Raises `opendal.exceptions.Unsupported` when the service does not
+    /// advertise `op.capability().write_with_expires`. A zero or
+    /// unrepresentable duration raises `opendal.exceptions.ConfigInvalid`.
+    pub expires: Option<std::time::Duration>,
     /// The algorithm the service uses to verify the full object before 
committing.
     /// `None` preserves the service default.
     pub checksum: Option<ocore::ChecksumAlgo>,
@@ -769,10 +786,12 @@ impl<'a, 'py> FromPyObject<'a, 'py> for WriteOptions {
             content_type: extract_optional(&dict, "content_type")?,
             content_disposition: extract_optional(&dict, 
"content_disposition")?,
             content_encoding: extract_optional(&dict, "content_encoding")?,
+            content_language: extract_optional(&dict, "content_language")?,
             if_match: extract_optional(&dict, "if_match")?,
             if_none_match: extract_optional(&dict, "if_none_match")?,
             if_not_exists: extract_optional(&dict, "if_not_exists")?,
             user_metadata: extract_optional(&dict, "user_metadata")?,
+            expires: extract_optional(&dict, "expires")?,
             checksum: extract_optional(&dict, "checksum")?
                 .map(|name: String| super::parse_checksum_algorithm(&name))
                 .transpose()?,
@@ -788,9 +807,9 @@ impl From<WriteOptions> for ocore::options::WriteOptions {
             content_type: opts.content_type,
             content_disposition: opts.content_disposition,
             content_encoding: opts.content_encoding,
-            content_language: None,
+            content_language: opts.content_language,
             user_metadata: opts.user_metadata,
-            expires: None,
+            expires: opts.expires,
             if_match: opts.if_match,
             if_none_match: opts.if_none_match,
             if_version_match: None,
diff --git a/bindings/python/tests/test_open_modes.py 
b/bindings/python/tests/test_open_modes.py
index 9d42079ad5..98df44e517 100644
--- a/bindings/python/tests/test_open_modes.py
+++ b/bindings/python/tests/test_open_modes.py
@@ -16,6 +16,7 @@
 # under the License.
 
 import contextlib
+from datetime import timedelta
 
 import pytest
 
@@ -271,10 +272,12 @@ NONE_WRITE_OPTIONS = {
     "content_type": None,
     "content_disposition": None,
     "content_encoding": None,
+    "content_language": None,
     "if_match": None,
     "if_none_match": None,
     "if_not_exists": None,
     "user_metadata": None,
+    "expires": None,
     "checksum": None,
     "offset": None,
 }
@@ -296,6 +299,8 @@ NONE_READ_OPTIONS = {
     "content_type": None,
     "cache_control": None,
     "content_disposition": None,
+    "content_language": None,
+    "expires": None,
 }
 
 
@@ -328,6 +333,8 @@ INVALID_OPEN_KWARGS = [
     ("rb", {"checksum": "crc32c"}, "checksum"),
     ("rb", {"if_not_exists": True}, "if_not_exists"),
     ("rb", {"content_encoding": "gzip"}, "content_encoding"),
+    ("rb", {"content_language": "fr"}, "content_language"),
+    ("rb", {"expires": timedelta(seconds=1)}, "expires"),
     ("rb", {"user_metadata": {"a": "b"}}, "user_metadata"),
     ("rb", {"content_type": "text/plain"}, "content_type"),
     ("rb", {"cache_control": "no-cache"}, "cache_control"),
diff --git a/bindings/python/tests/test_write.py 
b/bindings/python/tests/test_write.py
index f7402daf36..8d62797a71 100644
--- a/bindings/python/tests/test_write.py
+++ b/bindings/python/tests/test_write.py
@@ -18,6 +18,7 @@
 import gc
 import os
 import sys
+from datetime import timedelta
 from pathlib import Path
 from random import randint
 from uuid import uuid4
@@ -25,7 +26,10 @@ from uuid import uuid4
 import pytest
 
 import opendal
-from opendal.exceptions import NotFound
+from opendal.exceptions import ConfigInvalid, NotFound, Unsupported
+
+LANGUAGE = "fr-CA, en"
+EXPIRES = timedelta(minutes=1)
 
 
 @pytest.mark.need_capability("write", "delete", "stat")
@@ -412,3 +416,101 @@ def test_sync_writer_preserves_bytes_only_input(operator):
         assert file.write(expected) == len(expected)
     assert operator.read(filename) == expected
     operator.delete(filename)
+
+
[email protected]_capability("write", "stat", "delete", 
"write_with_content_language")
+def test_sync_write_with_content_language(operator):
+    path = f"test_file_{uuid4()}"
+    opened = f"test_file_{uuid4()}"
+    operator.write(path, b"bonjour", content_language=LANGUAGE)
+    with operator.open(opened, "wb", content_language=LANGUAGE) as file:
+        file.write(b"bonjour")
+    assert operator.stat(path).content_language == LANGUAGE
+    assert operator.stat(opened).content_language == LANGUAGE
+    operator.delete(path)
+    operator.delete(opened)
+
+
[email protected]
[email protected]_capability("write", "stat", "delete", 
"write_with_content_language")
+async def test_async_write_with_content_language(async_operator):
+    path = f"test_file_{uuid4()}"
+    opened = f"test_file_{uuid4()}"
+    await async_operator.write(path, b"bonjour", content_language=LANGUAGE)
+    async with await async_operator.open(
+        opened, "wb", content_language=LANGUAGE
+    ) as file:
+        await file.write(b"bonjour")
+    assert (await async_operator.stat(path)).content_language == LANGUAGE
+    assert (await async_operator.stat(opened)).content_language == LANGUAGE
+    await async_operator.delete(path)
+    await async_operator.delete(opened)
+
+
[email protected]_capability("write", "read", "stat", "delete")
+def test_sync_write_with_expires(operator):
+    path = f"test_file_{uuid4()}"
+    opened = f"test_file_{uuid4()}"
+    with pytest.raises(ValueError, match="negative"):
+        operator.write(path, b"rejected", expires=timedelta(seconds=-1))
+    if not operator.capability().write_with_expires:
+        with pytest.raises(Unsupported, match="expires"):
+            operator.write(path, b"rejected", expires=EXPIRES)
+        with pytest.raises(Unsupported, match="expires"):
+            operator.open(opened, "wb", expires=EXPIRES)
+        assert not operator.exists(path)
+        assert not operator.exists(opened)
+        return
+
+    operator.write(path, b"written", expires=EXPIRES)
+    with operator.open(opened, "wb", expires=EXPIRES) as file:
+        file.write(b"streamed")
+    assert operator.read(path) == b"written"
+    assert operator.read(opened) == b"streamed"
+    operator.delete(path)
+    operator.delete(opened)
+
+    with pytest.raises(ConfigInvalid):
+        operator.write(path, b"rejected", expires=timedelta(0))
+    with (
+        pytest.raises(ConfigInvalid),
+        operator.open(opened, "wb", expires=timedelta(0)) as file,
+    ):
+        file.write(b"rejected")
+    assert not operator.exists(path)
+    assert not operator.exists(opened)
+
+
[email protected]
[email protected]_capability("write", "read", "stat", "delete")
+async def test_async_write_with_expires(async_operator):
+    path = f"test_file_{uuid4()}"
+    opened = f"test_file_{uuid4()}"
+    with pytest.raises(ValueError, match="negative"):
+        await async_operator.write(path, b"rejected", 
expires=timedelta(seconds=-1))
+    if not async_operator.capability().write_with_expires:
+        with pytest.raises(Unsupported, match="expires"):
+            await async_operator.write(path, b"rejected", expires=EXPIRES)
+        with pytest.raises(Unsupported, match="expires"):
+            await async_operator.open(opened, "wb", expires=EXPIRES)
+        assert not await async_operator.exists(path)
+        assert not await async_operator.exists(opened)
+        return
+
+    await async_operator.write(path, b"written", expires=EXPIRES)
+    async with await async_operator.open(opened, "wb", expires=EXPIRES) as 
file:
+        await file.write(b"streamed")
+    assert await async_operator.read(path) == b"written"
+    assert await async_operator.read(opened) == b"streamed"
+    await async_operator.delete(path)
+    await async_operator.delete(opened)
+
+    with pytest.raises(ConfigInvalid):
+        await async_operator.write(path, b"rejected", expires=timedelta(0))
+    with pytest.raises(ConfigInvalid):
+        async with await async_operator.open(
+            opened, "wb", expires=timedelta(0)
+        ) as file:
+            await file.write(b"rejected")
+    assert not await async_operator.exists(path)
+    assert not await async_operator.exists(opened)
diff --git a/bindings/python/tests/typing/from_config.py 
b/bindings/python/tests/typing/from_config.py
index 883796dc21..9c58d2c5fb 100644
--- a/bindings/python/tests/typing/from_config.py
+++ b/bindings/python/tests/typing/from_config.py
@@ -65,3 +65,17 @@ Operator.from_config(service, context={"http": {"prox": 
"bad-key"}})  # type: ig
 AsyncOperator.from_config(service, layers=[{"name": "concurrent_limit"}])  # 
type: ignore
 AsyncOperator.from_config(service, layers=[{"name": "retry", "factor": 
"1.5"}])  # type: ignore
 AsyncOperator.from_config(service, layers=[{"name": "throttle"}])  # type: 
ignore
+
+
+def open_with_optional_write_options(
+    op: Operator, ttl: timedelta | None, lang: str | None
+) -> None:
+    op.open("page", "wb", expires=ttl, content_language=lang).close()
+    op.open("page", "wb", expires=5)  # type: ignore
+
+
+async def async_open_with_optional_write_options(
+    op: AsyncOperator, ttl: timedelta | None, lang: str | None
+) -> None:
+    await (await op.open("page", "wb", expires=ttl, 
content_language=lang)).close()
+    await op.open("page", "wb", content_language=1)  # type: ignore
diff --git a/dev/src/generate/python.rs b/dev/src/generate/python.rs
index 9dec7e7100..d4705a4085 100644
--- a/dev/src/generate/python.rs
+++ b/dev/src/generate/python.rs
@@ -979,6 +979,12 @@ const GENERATED_OPTIONS: &[PyOptions] = &[
                 OptionKind::OptionString,
                 "Option<String>",
             ),
+            (
+                "content_language",
+                "content_language",
+                OptionKind::OptionString,
+                "Option<String>",
+            ),
             (
                 "if_match",
                 "if_match",
@@ -1003,6 +1009,12 @@ const GENERATED_OPTIONS: &[PyOptions] = &[
                 OptionKind::OptionStringMap,
                 "Option<std::collections::HashMap<String, String>>",
             ),
+            (
+                "expires",
+                "expires",
+                OptionKind::OptionDuration,
+                "Option<std::time::Duration>",
+            ),
         ],
         // No binding mirrors core `WriteChecksum` yet (#9316), so Python
         // keeps its algorithm name from main.
@@ -1126,6 +1138,15 @@ const OPTIONS_PY_ORDER: &[&str] = &[
     "DeleteOptions",
 ];
 
+/// The keyword arguments whose `options.py` type also accepts `None`, as
+/// `open()` does at runtime, as `(class, name)`. The other keys exclude
+/// `None`, because widening them gives code that reads their values a new
+/// `None`.
+const KWARGS_ACCEPT_NONE: &[(&str, &str)] = &[
+    ("WriteOptions", "content_language"),
+    ("WriteOptions", "expires"),
+];
+
 /// Render model of one generated Python options class.
 #[derive(Debug, Serialize)]
 struct PyClass {
@@ -1187,6 +1208,9 @@ fn lowering(kind: OptionKind, rust_type: &str) -> 
Option<(OptionType, &'static s
         (OptionKind::OptionStringMap, 
"Option<std::collections::HashMap<String, String>>") => {
             (OptionType::Dict, "", "")
         }
+        (OptionKind::OptionDuration, "Option<std::time::Duration>") => {
+            (OptionType::TimeDelta, "", "")
+        }
         // A flag whose keyword argument defaults to `None`, such as
         // `list(recursive=None)`.
         (OptionKind::Bool, "Option<bool>") => (OptionType::Bool, "", 
".unwrap_or(false)"),
@@ -1213,6 +1237,9 @@ struct PyNames {
     /// The core capabilities; the Python `Capability` has an attribute of
     /// the same name for each.
     capabilities: Vec<CapabilityField>,
+    /// The core `Metadata` accessors; the Python `Metadata` has a property
+    /// of the same name for each.
+    metadata: Vec<String>,
     /// Each core `ErrorKind` variant and the `opendal.exceptions` class that
     /// `bindings/python/src/errors.rs` raises for it.
     exceptions: BTreeMap<String, String>,
@@ -1222,6 +1249,11 @@ impl PyNames {
     fn parse(workspace_dir: &Path) -> Result<Self> {
         let capabilities =
             
capability::parse(&workspace_dir.join("core/core/src/types/capability.rs"))?;
+        let metadata =
+            
metadata::parse_accessors(&workspace_dir.join("core/core/src/types/metadata.rs"))?
+                .into_iter()
+                .map(|accessor| accessor.name)
+                .collect();
         let errors = workspace_dir.join("bindings/python/src/errors.rs");
         // `format_pyerr_impl` maps each kind with a line such as
         // `ocore::ErrorKind::Unsupported => Unsupported::new_err(e),`.
@@ -1246,6 +1278,7 @@ impl PyNames {
         }
         Ok(Self {
             capabilities,
+            metadata,
             exceptions,
         })
     }
@@ -1260,11 +1293,12 @@ impl PyNames {
 ///   A link with plain text to a Rust path, such as
 ///   ``[checksum specification][crate::docs::specs::checksum]``, keeps only
 ///   its text. Links to URLs stay.
-/// - Code spans that name a core capability, error kind (with or without
-///   `ErrorKind::`), or renamed field use the Python check, exception, or
-///   keyword argument instead (see [`py_code_span`]); other code spans stay
-///   as written. A `Self::` code span that keeps no Python name fails
-///   generation, because that name means nothing to Python callers.
+/// - Code spans that name a core capability, metadata accessor, error kind
+///   (with or without `ErrorKind::`), or renamed field use the Python check,
+///   property, exception, or keyword argument instead (see
+///   [`py_code_span`]); other code spans stay as written. A `Self::` code
+///   span that keeps no Python name fails generation, because that name
+///   means nothing to Python callers.
 /// - Core returns an error kind where Python raises the exception, so a
 ///   `returns` right before an exception reads `raises`.
 /// - A sentence that names a Rust layer (a `crate::layers::` code span) is
@@ -1386,13 +1420,17 @@ fn raises(text: &str) -> String {
     out
 }
 
-/// The Python form of a code span that names a core capability, error kind,
-/// or renamed field, or `None` to keep the code span as written.
+/// The Python form of a code span that names a core capability, metadata
+/// accessor, error kind, or renamed field, or `None` to keep the code span as
+/// written.
 ///
 /// - `Capability::list_with_start_after` becomes
 ///   `op.capability().list_with_start_after`: the `Capability` that
 ///   `Operator.capability()` returns has an attribute of the same name for
 ///   every core capability, so callers can check it before setting an option.
+/// - `Metadata::content_language` becomes `Metadata.content_language`: the
+///   `Metadata` that `stat()` returns has a property of the same name for
+///   every core accessor.
 /// - `ErrorKind::Unsupported` becomes `opendal.exceptions.Unsupported`, the
 ///   exception that `bindings/python/src/errors.rs` raises for that kind.
 ///   So does a bare `Unsupported`, which core writes when an earlier
@@ -1419,6 +1457,13 @@ fn py_code_span(code: &str, names: &PyNames, renames: 
&[(&str, &str)]) -> Option
             .any(|f| f.name == name)
             .then(|| format!("op.capability().{name}"));
     }
+    if let Some(name) = path.strip_prefix("Metadata::") {
+        return names
+            .metadata
+            .iter()
+            .any(|accessor| accessor == name)
+            .then(|| format!("Metadata.{name}"));
+    }
     let kind = path.strip_prefix("ErrorKind::").unwrap_or(code);
     let class = names.exceptions.get(kind)?;
     Some(format!("opendal.exceptions.{class}"))
@@ -1669,6 +1714,7 @@ enum OptionType {
     Int,
     Bool,
     DateTime,
+    TimeDelta,
     Dict,
     ChecksumAlgo,
 }
@@ -1679,6 +1725,7 @@ fn make_option_type(ty: OptionType) -> &'static str {
         OptionType::Int => "int",
         OptionType::Bool => "bool",
         OptionType::DateTime => "datetime",
+        OptionType::TimeDelta => "timedelta",
         OptionType::Dict => "dict[str, str]",
         OptionType::ChecksumAlgo => "ChecksumAlgorithm | None",
     }
@@ -1706,13 +1753,21 @@ fn render_options_py(generated: &[PyClass]) -> 
Result<String> {
     {
         bail!("add {} to OPTIONS_PY_ORDER", extra.name);
     }
+    for &(class, name) in KWARGS_ACCEPT_NONE {
+        if !generated
+            .iter()
+            .any(|c| c.name == class && c.fields.iter().any(|f| f.name == 
name))
+        {
+            bail!("KWARGS_ACCEPT_NONE lists {class}.{name}, which is not 
generated");
+        }
+    }
 
     let mut out = String::new();
     out.push_str(PYTHON_LICENSE_HEADER);
     out.push_str("\n# DO NOT EDIT IT MANUALLY. This file is generated by 
opendal/dev/generate/python.rs.\n\n");
     out.push_str(OPTIONS_MODULE_DOC);
     out.push_str(
-        "\nfrom __future__ import annotations\n\nfrom datetime import 
datetime\nfrom typing import Literal, TypeAlias, TypedDict\n",
+        "\nfrom __future__ import annotations\n\nfrom datetime import 
datetime, timedelta\nfrom typing import Literal, TypeAlias, TypedDict\n",
     );
     out.push_str(
         "\nChecksumAlgorithm: TypeAlias = Literal[\n    \"crc32c\", 
\"crc64nvme\", \"crc64ecma\", \"md5\", \"sha1\", 
\"sha256\"\n]\n\"\"\"Full-object checksum algorithms. Each service defines the 
algorithms it supports.\"\"\"\n",
@@ -1730,8 +1785,13 @@ fn render_options_py(generated: &[PyClass]) -> 
Result<String> {
         push_docstring(&mut out, &class.doc.join("\n"));
         out.push('\n');
         for field in &class.fields {
+            let none = if KWARGS_ACCEPT_NONE.contains(&(class.name, 
field.name)) {
+                " | None"
+            } else {
+                ""
+            };
             out.push_str(&format!(
-                "    {}: {}\n",
+                "    {}: {}{none}\n",
                 field.name,
                 make_option_type(field.py_type)
             ));
@@ -1743,7 +1803,7 @@ fn render_options_py(generated: &[PyClass]) -> 
Result<String> {
     // TypedDict inherits both.
     exports.push("OpenKwargs".to_string());
     out.push_str(
-        "\n\nclass OpenKwargs(ReadKwargs, WriteKwargs, total=False):\n    
\"\"\"Keyword arguments for `Operator.open` and `AsyncOperator.open`.\n\n    
Accepted keys depend on `mode`: read modes (`\"r\"`, `\"rb\"`, `\"br\"`) 
accept\n    reader options, while write, append, and create modes (`\"w\"`, 
`\"wb\"`,\n    `\"ab\"`, `\"xb\"`, etc.) accept writer options. 
`Operator.open()` and\n    `AsyncOperator.open()` ignore an option of the other 
mode when its value\n    is `None`, and raise `T [...]
+        "\n\nclass OpenKwargs(ReadKwargs, WriteKwargs, total=False):\n    
\"\"\"Keyword arguments for `Operator.open` and `AsyncOperator.open`.\n\n    
Accepted keys depend on `mode`: read modes (`\"r\"`, `\"rb\"`, `\"br\"`) 
accept\n    reader options, while write, append, and create modes (`\"w\"`, 
`\"wb\"`,\n    `\"ab\"`, `\"xb\"`, etc.) accept writer options. 
`Operator.open()` and\n    `AsyncOperator.open()` ignore an option of the other 
mode when its value\n    is `None`, and raise `T [...]
     );
 
     out.push_str("\n\n__all__ = [\n");
@@ -1975,8 +2035,9 @@ mod tests {
     ];
 
     /// The `WriteOptions` keyword arguments on main (a2ef00d6e), copied
-    /// from `bindings/python/src/options.rs`.
-    const WRITE_KWARGS: [&str; 12] = [
+    /// from `bindings/python/src/options.rs`, plus `content_language` and
+    /// `expires`.
+    const WRITE_KWARGS: [&str; 14] = [
         "append",
         "chunk",
         "concurrent",
@@ -1984,10 +2045,12 @@ mod tests {
         "content_type",
         "content_disposition",
         "content_encoding",
+        "content_language",
         "if_match",
         "if_none_match",
         "if_not_exists",
         "user_metadata",
+        "expires",
         "checksum",
     ];
 
@@ -2504,8 +2567,9 @@ print(json.dumps(docs))
         }
     }
 
-    /// The `WriteOptions` surface on main (a2ef00d6e) and the checks and
-    /// exceptions its docs name. It pins no core wording.
+    /// The `WriteOptions` surface on main (a2ef00d6e), plus
+    /// `content_language` and `expires`, and the checks and exceptions its
+    /// docs name. It pins no core wording.
     fn assert_write_surface(class: &PyClass) {
         let fields: Vec<String> = class
             .fields
@@ -2522,10 +2586,12 @@ print(json.dumps(docs))
                 "content_type: Option<String>",
                 "content_disposition: Option<String>",
                 "content_encoding: Option<String>",
+                "content_language: Option<String>",
                 "if_match: Option<String>",
                 "if_none_match: Option<String>",
                 "if_not_exists: Option<bool>",
                 "user_metadata: Option<std::collections::HashMap<String, 
String>>",
+                "expires: Option<std::time::Duration>",
                 "checksum: Option<ocore::ChecksumAlgo>",
             ]
         );
@@ -2568,10 +2634,12 @@ print(json.dumps(docs))
                 "content_type: write_with_content_type / ".to_string(),
                 "content_disposition: write_with_content_disposition / 
".to_string(),
                 "content_encoding: write_with_content_encoding / ".to_string(),
+                "content_language: write_with_content_language / ".to_string(),
                 format!("if_match: write_with_if_match / {condition}"),
                 format!("if_none_match: write_with_if_none_match / 
{condition}"),
                 format!("if_not_exists: write_with_if_not_exists / 
{condition}"),
                 "user_metadata: write_with_user_metadata / ".to_string(),
+                "expires: write_with_expires / Unsupported 
ConfigInvalid".to_string(),
                 "checksum:  / ".to_string(),
             ]
         );
@@ -2588,6 +2656,7 @@ print(json.dumps(docs))
                 "WriteOptions::",
                 "Operator::",
                 "Reader::",
+                "Metadata::",
                 "returns `opendal.exceptions.",
                 "return an error",
                 "Some(",
@@ -3321,8 +3390,8 @@ print(json.dumps(docs))
         assert!(rs.contains(&format!("{expected}}}\n")), "{rs}");
     }
 
-    /// The `WriteOptions` API on main (a2ef00d6e), with docstrings from core
-    /// except for `checksum`.
+    /// The `WriteOptions` API on main (a2ef00d6e), plus `content_language`
+    /// and `expires`, with docstrings from core except for `checksum`.
     #[test]
     fn test_write_options_match_main() {
         let parsed = core_options();
@@ -3390,6 +3459,13 @@ print(json.dumps(docs))
                 doc(name).doc
             );
         }
+        // The stored language reads back as the `stat()` result property.
+        assert_eq!(
+            spans(&doc("content_language").doc, "Metadata."),
+            ["content_language"],
+            "{:?}",
+            doc("content_language").doc
+        );
         assert!(
             doc("if_none_match")
                 .doc
@@ -3407,8 +3483,9 @@ print(json.dumps(docs))
             append.doc
         );
 
-        // Each keyword sets the core field main set, and every other core
-        // field keeps its default, as main's `..Default::default()` did.
+        // Each keyword sets the core field main set, `content_language` and
+        // `expires` pass through, and every other core field keeps its
+        // default, as main's `..Default::default()` did.
         let (set, defaulted): (Vec<_>, Vec<_>) = class
             .conversion
             .iter()
@@ -3422,7 +3499,9 @@ print(json.dumps(docs))
                 "content_type: opts.content_type",
                 "content_disposition: opts.content_disposition",
                 "content_encoding: opts.content_encoding",
+                "content_language: opts.content_language",
                 "user_metadata: opts.user_metadata",
+                "expires: opts.expires",
                 "if_match: opts.if_match",
                 "if_none_match: opts.if_none_match",
                 "if_not_exists: opts.if_not_exists.unwrap_or(false)",
@@ -3432,8 +3511,6 @@ print(json.dumps(docs))
             ]
         );
         for field in [
-            "content_language: None",
-            "expires: None",
             "if_version_match: None",
             "if_version_not_match: None",
             "if_not_changed: None",
@@ -3473,10 +3550,12 @@ print(json.dumps(docs))
                 "content_type: extract_optional(&dict, \"content_type\")?,",
                 "content_disposition: extract_optional(&dict, 
\"content_disposition\")?,",
                 "content_encoding: extract_optional(&dict, 
\"content_encoding\")?,",
+                "content_language: extract_optional(&dict, 
\"content_language\")?,",
                 "if_match: extract_optional(&dict, \"if_match\")?,",
                 "if_none_match: extract_optional(&dict, \"if_none_match\")?,",
                 "if_not_exists: extract_optional(&dict, \"if_not_exists\")?,",
                 "user_metadata: extract_optional(&dict, \"user_metadata\")?,",
+                "expires: extract_optional(&dict, \"expires\")?,",
                 "checksum: extract_optional(&dict, \"checksum\")?\
                  .map(|name: String| 
super::parse_checksum_algorithm(&name)).transpose()?,",
             ]
@@ -3977,10 +4056,12 @@ print(json.dumps(docs))
                 "content_type: str",
                 "content_disposition: str",
                 "content_encoding: str",
+                "content_language: str | None",
                 "if_match: str",
                 "if_none_match: str",
                 "if_not_exists: bool",
                 "user_metadata: dict[str, str]",
+                "expires: timedelta | None",
                 "checksum: ChecksumAlgorithm | None",
             ]
         );
@@ -4038,7 +4119,8 @@ print(json.dumps(docs))
             "In write, append, and create modes, `open()` sets `chunk` to 256 
KiB when \
              `chunk` is unset or `0` and the service has no \
              `op.capability().write_multi_min_size`. `open()` raises \
-             `opendal.exceptions.Unsupported` for appending, a condition, or a 
`checksum`",
+             `opendal.exceptions.Unsupported` for appending, a condition, 
`expires`, or a \
+             `checksum`",
             "raise `opendal.exceptions.ConditionNotMatch` for a failed 
condition and \
              `OSError` for any other error, while `close()` raises each error 
as its \
              `opendal.exceptions` class.",
@@ -4057,6 +4139,21 @@ print(json.dumps(docs))
         }
     }
 
+    /// A `KWARGS_ACCEPT_NONE` entry must name a generated keyword argument.
+    #[test]
+    fn test_kwargs_accept_none_names_generated_keys() {
+        let mut generated = generated_classes(&core_options(), 
&py_names()).unwrap();
+        let write = generated
+            .iter_mut()
+            .find(|c| c.name == "WriteOptions")
+            .unwrap();
+        write.fields.retain(|f| f.name != "expires");
+        assert_eq!(
+            render_options_py(&generated).unwrap_err().to_string(),
+            "KWARGS_ACCEPT_NONE lists WriteOptions.expires, which is not 
generated"
+        );
+    }
+
     /// The `list` and `scan` keyword arguments and defaults on main
     /// (4ae8e6122), copied from `python/opendal/operator.pyi`, plus `glob`
     /// on `list`.
@@ -4138,14 +4235,15 @@ print(json.dumps(docs))
     }
 
     /// The `write` and `presign_write` keyword arguments and defaults on
-    /// main (a2ef00d6e), copied from `python/opendal/operator.pyi`.
+    /// main (a2ef00d6e), copied from `python/opendal/operator.pyi`, plus
+    /// `content_language` and `expires` on `write`.
     #[test]
     fn test_write_signatures_match_main() {
         let methods = operator_kwargs();
         let write = "append=None chunk=None concurrent=None cache_control=None 
\
                      content_type=None content_disposition=None 
content_encoding=None \
-                     if_match=None if_none_match=None if_not_exists=None \
-                     user_metadata=None checksum=None";
+                     content_language=None if_match=None if_none_match=None \
+                     if_not_exists=None user_metadata=None expires=None 
checksum=None";
         let presign = "content_type=None content_disposition=None 
content_encoding=None \
                        cache_control=None if_match=None if_none_match=None \
                        if_not_exists=None user_metadata=None";
@@ -4243,7 +4341,14 @@ print(json.dumps(docs))
                 "AsyncOperator",
                 "presign_write",
                 "WriteOptions",
-                &["append", "chunk", "concurrent", "checksum"][..],
+                &[
+                    "append",
+                    "chunk",
+                    "concurrent",
+                    "content_language",
+                    "expires",
+                    "checksum",
+                ][..],
             ),
             ("Operator", "copy", "CopyOptions", &[][..]),
             ("AsyncOperator", "copy", "CopyOptions", &[][..]),
@@ -4340,7 +4445,7 @@ print(json.dumps(docs))
             options.fields.iter().position(|f| f.name == name).unwrap()
         }
         type Mutation = fn(&mut OptionsStruct);
-        let cases: [(&str, Mutation, &str); 49] = [
+        let cases: [(&str, Mutation, &str); 51] = [
             (
                 "ListOptions",
                 |list| {
@@ -4634,6 +4739,24 @@ print(json.dumps(docs))
                 "core WriteOptions::user_metadata has kind OptionMetadata; \
                  Python WriteOptions.user_metadata requires OptionStringMap",
             ),
+            (
+                "WriteOptions",
+                |write| {
+                    let i = position(write, "content_language");
+                    write.fields[i].kind = OptionKind::OptionStringMap;
+                },
+                "core WriteOptions::content_language has kind OptionStringMap; 
\
+                 Python WriteOptions.content_language requires OptionString",
+            ),
+            (
+                "WriteOptions",
+                |write| {
+                    let i = position(write, "expires");
+                    write.fields[i].kind = OptionKind::OptionU64;
+                },
+                "core WriteOptions::expires has kind OptionU64; \
+                 Python WriteOptions.expires requires OptionDuration",
+            ),
             (
                 "WriteOptions",
                 |write| {
@@ -5120,6 +5243,7 @@ print(json.dumps(docs))
             "Bare `Unsupported` and [`NotFound`] name kinds too.",
             "Unknown `Capability::no_such_flag`, `ErrorKind::NoSuchKind`, and 
prose Capability::list stay.",
             "So do `NoSuchKind`, `crate::NotFound`, `ErrorKind`, `notfound`, 
and prose Unsupported.",
+            "Stat returns [`Metadata::content_language`] and 
`crate::Metadata::etag`, not `Metadata::no_such_field`.",
         ]
         .map(String::from);
         assert_eq!(
@@ -5132,6 +5256,7 @@ print(json.dumps(docs))
                 "Bare `opendal.exceptions.Unsupported` and 
`opendal.exceptions.NotFound` name kinds too.",
                 "Unknown `Capability::no_such_flag`, `ErrorKind::NoSuchKind`, 
and prose Capability::list stay.",
                 "So do `NoSuchKind`, `crate::NotFound`, `ErrorKind`, 
`notfound`, and prose Unsupported.",
+                "Stat returns `Metadata.content_language` and `Metadata.etag`, 
not `Metadata::no_such_field`.",
             ]
         );
 
@@ -6231,12 +6356,19 @@ print(json.dumps(docs))
                     "write_with_content_type",
                     "write_with_content_disposition",
                     "write_with_content_encoding",
+                    "write_with_content_language",
                     "write_with_if_match",
                     "write_with_if_none_match",
                     "write_with_if_not_exists",
                     "write_with_user_metadata",
+                    "write_with_expires",
+                ][..],
+                &[
+                    "ConditionNotMatch",
+                    "ConfigInvalid",
+                    "Conflict",
+                    "Unsupported",
                 ][..],
-                &["ConditionNotMatch", "Conflict", "Unsupported"][..],
             ),
             (
                 "CopyOptions",

Reply via email to