Skip to content

Commit 550ba1a

Browse files
ifeLawalRuwann
andauthored
Update sqlalchemy example to work with Python 3.8, 3.9 and 3.10 (#2025)
Co-authored-by: Ruwann <ruwanlambrichts@gmail.com>
1 parent 1844a2f commit 550ba1a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/sqlalchemy/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import datetime
21
import logging
2+
from datetime import datetime, timezone
33

44
import connexion
55
import orm
@@ -29,7 +29,7 @@ def put_pet(pet_id, pet):
2929
p.update(**pet)
3030
else:
3131
logging.info("Creating pet %s..", pet_id)
32-
pet["created"] = datetime.datetime.now(datetime.UTC)
32+
pet["created"] = datetime.now(timezone.utc)
3333
db_session.add(orm.Pet(**pet))
3434
db_session.commit()
3535
return NoContent, (200 if p is not None else 201)

0 commit comments

Comments
 (0)