Azure / Azure/azure-sdk-for-python

[Storage] StorageManagementClient.storage_task_assignments.begin_create(...) fail with date-time format not aligned with server request.

Chiusa
#37,406 6 commenti 0 reazioni 1 assegnatario Rivendicata da @msyyc Vedi su GitHub
Mgmt needs-team-attention Service Attention Storage
Lingua principale
Python
Stelle
5.6k
Fork
3.4k
Merge medio
2g 2h
PR unite (30g)
213

Descrizione

- **Package Name**: https://pypi.org/project/azure-mgmt-storage/21.2.1/
- **Package Version**: 21.2.1
- **Operating System**: N/A
- **Python Version**: N/A

**Describe the bug**
An external customer recently tried to use the Python SDK to create Task assignments and they are running into validation errors and Task assignment creation is not accepted.

This is because they tried to pass in date times with and without padding on "2024-09-22T19:50:32" format, which the Python SDK always Serializes converts to UTC: "2024-09-22T19:50:32.000Z" which looks to be not accepted by backend.

That is, upon calling this:
```
StorageManagementClient.storage_task_assignments.begin_create(...)
```
A log line is shown:
"Datetime with no tzinfo will be considered UTC."

Customer also shared the root cause might be because the default serializer used converts to the format:
```
>>> from azure.mgmt.storage._serialization import Serializer
>>> Serializer.serialize_iso("2024-09-22T19:50:32")
Datetime with no tzinfo will be considered UTC.
'2024-09-22T19:50:32.000Z'
```

Options:
Can SDK be updated to sync with what SRP/infra accepts? Possibly update the parameters passed to Serializer?

**To Reproduce**
Steps to reproduce the behavior:
see above comment.

**Expected behavior**
The datetime send from python SDK can be accepted by Server.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.