Aware datetime serialization changes scheduled-message instants by ignoring UTC offsets

Ouverte
#980 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@Kayvan-Zahiri y travaille déjà.

Depuis le 24/10/2026.

  • #981 par @Kayvan-Zahiri — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
35/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
python
Domaine
api, backend

Piste de recherche

Read the handwritten twilio.base.serialize.iso8601_datetime serializer and the public-client tests for scheduled messages. Reproduce the two timezone-offset cases through the mocked HTTP transport, then check that naive datetimes, date-only values, preformatted strings, and the unset sentinel retain their existing behavior. Done means aware datetimes serialize to the correct UTC instant; the issue reports that pull request #981 is already open.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Issue

The handwritten twilio.base.serialize.iso8601_datetime formats timezone-aware datetimes with strftime("%Y-%m-%dT%H:%M:%SZ") without converting their timezone to UTC. This changes the represented instant when the datetime has a nonzero UTC offset.

Through the public client (mocked HTTP transport), Client(...).messages.create(..., schedule_type="fixed", send_at=datetime(2030, 1, 2, 1, 30, tzinfo=timezone(timedelta(hours=5, minutes=30)))) currently sends SendAt=2030-01-02T01:30:00Z. It should send 2030-01-01T20:00:00Z. Negative offsets can similarly cross the next day. Twilio's scheduling timestamp documentation calls for a UTC ISO8601 timestamp.

Proposed fix and validation

Convert aware datetimes to UTC before adding the Z suffix. Keep naive datetimes, date-only values, preformatted strings and the unset sentinel's existing behavior. This touches the handwritten shared serializer, not generated REST methods.

Two public-client timezone cases fail before the fix; four controls pass. Afterward the full required make test workflow passes:647 tests, both Flake8 runs, Autoflake and Black (797 files). Tested Python3.12; no real messages or live Twilio requests, and no full Python matrix. AI-assisted contribution, maintainer review pending.

Langage dominant
Python
Étoiles
2.1k
Forks
821
Merge moyen
9 h 33 min
PR mergées (30 j)
3

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de twilio/twilio-python

Toutes les issues de twilio/twilio-python

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.