Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot generate_metadata_xml in Python 3.12 #409

Open
jlgonzalez-martinez opened this issue May 8, 2024 · 0 comments
Open

Cannot generate_metadata_xml in Python 3.12 #409

jlgonzalez-martinez opened this issue May 8, 2024 · 0 comments

Comments

@jlgonzalez-martinez
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant