|
1 | 1 | """Output request model following CloudEvents 1.0 specification.""" |
2 | 2 |
|
3 | 3 | from typing import Optional |
4 | | -from datetime import datetime |
| 4 | +from datetime import datetime, timezone |
5 | 5 | from pydantic import BaseModel, Field |
6 | 6 | import uuid |
7 | 7 |
|
@@ -92,7 +92,7 @@ class OutputRequest(BaseModel): |
92 | 92 | ) |
93 | 93 |
|
94 | 94 | time: str = Field( |
95 | | - default_factory=lambda: datetime.utcnow().isoformat() + "Z", |
| 95 | + default_factory=lambda: datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"), |
96 | 96 | description="Timestamp when the output request was triggered (ISO 8601 format)" |
97 | 97 | ) |
98 | 98 |
|
@@ -222,12 +222,12 @@ def build(self) -> OutputRequest: |
222 | 222 | raise ValueError("data is required") |
223 | 223 |
|
224 | 224 | return OutputRequest( |
225 | | - spec_version=self._spec_version, |
| 225 | + specversion=self._spec_version, |
226 | 226 | id=self._id or str(uuid.uuid4()), |
227 | 227 | source=self._source, |
228 | | - time=self._time or datetime.utcnow().isoformat() + "Z", |
| 228 | + time=self._time or datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"), |
229 | 229 | type=self._type, |
230 | | - data_content_type=self._data_content_type, |
| 230 | + datacontenttype=self._data_content_type, |
231 | 231 | data=self._data, |
232 | 232 | xsapsisgwdestapp=self._xsapsisgwdestapp, |
233 | 233 | xsapsisgwdestappid=self._xsapsisgwdestappid, |
|
0 commit comments