Skip to content

Cannot generate_metadata_xml in Python 3.12 #409

Open
@jlgonzalez-martinez

Description

Using Python 3.12 fails to generate_metadata_xml with a DeprecationWarning:

duration = 'P10D', timestamp = None

@staticmethod
def parse_duration(duration, timestamp=None):
    """
    Interprets a ISO8601 duration value relative to a given timestamp.

    :param duration: The duration, as a string.
    :type: string

    :param timestamp: The unix timestamp we should apply the duration to.
                      Optional, default to the current time.
    :type: string

    :return: The new timestamp, after the duration is applied.
    :rtype: int
    """
    assert isinstance(duration, compat.str_type)
    assert timestamp is None or isinstance(timestamp, int)

    timedelta = duration_parser(duration)
    if timestamp is None:
       data = datetime.utcnow() + timedelta

E DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

The issue is in the parse_duration_method in the OneLogin_Saml2_Utils class.

Activity

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

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