imagekit-developer/imagekit-python

Invalid format string exception been thrown when calling get_signature_timestamp in URL.py

Closed this issue · 0 comments

def get_signature_timestamp(expiry_seconds: int = None) -> int:
    """
    this function returns the signature timestamp to be used
    with the generated url. 
    If expiry_seconds is provided, it returns expiry_seconds added
    to the current unix time, otherwise the default time stamp
    is returned.
    """
    if not expiry_seconds:
        return Default.DEFAULT_TIMESTAMP.value
    current_timestamp = int(dt.now().strftime("%s"))

    return current_timestamp + expiry_seconds

in above mentioned method there is a format string %s which should have been %S because datetime does not use %s as format string for seconds , which leads in Invalid format string Exception being thrown which refrain signed urls with expiry.