Skip to content

SqliteCache uses deprecated sqlite3 datetime adapters and fails on whole-second timestamps #1507

Open

Description

@cvas22

Zeep version: 4.3.3 (current main, 1b7072c). No WSDL needed, it's just the cache.

SqliteCache relies on sqlite3's default datetime adapter and timestamp converter. Those are deprecated since Python 3.12, so every cache read and write emits a DeprecationWarning. The converter also can't parse what the adapter writes when the timestamp lands on a whole second: isoformat() drops the microseconds, the stored value looks like 2026-11-15 09:00:00+00:00, and get() raises ValueError. It's rare, but once it happens that URL keeps failing to load until the row is replaced.

import datetime, os, tempfile
import freezegun
from zeep import cache

c = cache.SqliteCache(path=os.path.join(tempfile.mkdtemp(), "cache.db"))
with freezegun.freeze_time(datetime.datetime(2026, 11, 15, 9, 0, 0, tzinfo=datetime.timezone.utc)):
    c.add("http://example.com/service.wsdl", b"content")
c.get("http://example.com/service.wsdl")
# ValueError: invalid literal for int() with base 10: b'00+00'

I've got a fix that stores the timestamp as ISO text and parses it with datetime.fromisoformat, which also reads rows written by older versions. I'll open a PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions