|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /proc/self/root/lib/python2.7/site-packages/itsdangerous/ |
Upload File : |
�
-/�_c @ s� d d l Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d
l
m Z d d l
m Z d d l
m
Z
d d
l m Z d d l m Z d e f d � � YZ d e f d � � YZ d S( i����N( t datetimei ( t text_type( t
base64_decode( t
base64_encode( t bytes_to_int( t int_to_bytes( t
want_bytes( t BadSignature( t BadTimeSignature( t SignatureExpired( t
Serializer( t Signert TimestampSignerc B sD e Z d Z d � Z d � Z d � Z d e d � Z d d � Z RS( s� Works like the regular :class:`.Signer` but also records the time
of the signing and can be used to expire signatures. The
:meth:`unsign` method can raise :exc:`.SignatureExpired` if the
unsigning failed because the signature is expired.
c C s t t j � � S( sT Returns the current timestamp. The function must return an
integer.
( t intt time( t self( ( s: /tmp/pip-install-sTXtzD/itsdangerous/itsdangerous/timed.pyt
get_timestamp s c C s
t j | � S( sa Used to convert the timestamp from :meth:`get_timestamp` into
a datetime object.
( R t utcfromtimestamp( R t ts( ( s: /tmp/pip-install-sTXtzD/itsdangerous/itsdangerous/timed.pyt timestamp_to_datetime s c C sV t | � } t t | j � � � } t | j � } | | | } | | | j | � S( s: Signs the given string and also attaches time information.( R R R R t sept
get_signature( R t valuet timestampR ( ( s: /tmp/pip-install-sTXtzD/itsdangerous/itsdangerous/timed.pyt sign$ s
c
C s� y t j | | � } d } Wn( t k
rF } | } | j p@ d } n Xt | j � } | | k r� | rq | � n t d d | �� n | j | d � \ } } y t t
| � � } Wn t k
r� d } n X| d k r� t t | � d | d | �� n | d k rt d d | �� n | d k ru| j
� | } | | k rut d | | f d | d | j | � �� qun | r�| | j | � f S| S( s= Works like the regular :meth:`.Signer.unsign` but can also
validate the time. See the base docstring of the class for
the general behavior. If ``return_timestamp`` is ``True`` the
timestamp of the signature will be returned as a naive
:class:`datetime.datetime` object in UTC.
t s timestamp missingt payloadi t date_signeds Malformed timestamps Signature age %s > %s secondsN( R t unsignt NoneR R R R R t rsplitR R t ExceptionR R R R (
R R t max_aget return_timestampt resultt sig_errort eR R t age( ( s: /tmp/pip-install-sTXtzD/itsdangerous/itsdangerous/timed.pyR , s>