Linux newlinux5.pouyasazan.org 3.10.0-962.3.2.lve1.5.60.el7.x86_64 #1 SMP Fri Jul 23 07:07:00 EDT 2021 x86_64
LiteSpeed
Server IP : 88.99.66.243 & Your IP : 216.73.216.178
Domains :
Cant Read [ /etc/named.conf ]
User : wdbbsgxf
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib /
python2.7 /
site-packages /
pyrfc3339 /
Delete
Unzip
Name
Size
Permission
Date
Action
__init__.py
599
B
-rw-r--r--
2018-05-26 20:42
__init__.pyc
811
B
-rw-r--r--
2020-04-14 19:05
__init__.pyo
811
B
-rw-r--r--
2020-04-14 19:05
generator.py
2.12
KB
-rw-r--r--
2018-05-26 20:42
generator.pyc
2.3
KB
-rw-r--r--
2020-04-14 19:05
generator.pyo
2.3
KB
-rw-r--r--
2020-04-14 19:05
parser.py
3.19
KB
-rw-r--r--
2018-05-26 20:42
parser.pyc
3.16
KB
-rw-r--r--
2020-04-14 19:05
parser.pyo
3.16
KB
-rw-r--r--
2020-04-14 19:05
utils.py
3.33
KB
-rw-r--r--
2018-06-11 04:26
utils.pyc
4.57
KB
-rw-r--r--
2020-04-14 19:05
utils.pyo
4.57
KB
-rw-r--r--
2020-04-14 19:05
Save
Rename
import pytz from pyrfc3339.utils import timezone, timedelta_seconds def generate(dt, utc=True, accept_naive=False, microseconds=False): ''' Generate an :RFC:`3339`-formatted timestamp from a :class:`datetime.datetime`. >>> from datetime import datetime >>> generate(datetime(2009,1,1,12,59,59,0,pytz.utc)) '2009-01-01T12:59:59Z' The timestamp will use UTC unless `utc=False` is specified, in which case it will use the timezone from the :class:`datetime.datetime`'s :attr:`tzinfo` parameter. >>> eastern = pytz.timezone('US/Eastern') >>> dt = eastern.localize(datetime(2009,1,1,12,59,59)) >>> generate(dt) '2009-01-01T17:59:59Z' >>> generate(dt, utc=False) '2009-01-01T12:59:59-05:00' Unless `accept_naive=True` is specified, the `datetime` must not be naive. >>> generate(datetime(2009,1,1,12,59,59,0)) Traceback (most recent call last): ... ValueError: naive datetime and accept_naive is False >>> generate(datetime(2009,1,1,12,59,59,0), accept_naive=True) '2009-01-01T12:59:59Z' If `accept_naive=True` is specified, the `datetime` is assumed to be UTC. Attempting to generate a local timestamp from a naive datetime will result in an error. >>> generate(datetime(2009,1,1,12,59,59,0), accept_naive=True, utc=False) Traceback (most recent call last): ... ValueError: cannot generate a local timestamp from a naive datetime ''' if dt.tzinfo is None: if accept_naive is True: if utc is True: dt = dt.replace(tzinfo=pytz.utc) else: raise ValueError("cannot generate a local timestamp from " + "a naive datetime") else: raise ValueError("naive datetime and accept_naive is False") if utc is True: dt = dt.astimezone(pytz.utc) timestamp = dt.strftime('%Y-%m-%dT%H:%M:%S') if microseconds is True: timestamp += dt.strftime('.%f') if dt.tzinfo is pytz.utc: timestamp += 'Z' else: timestamp += timezone(timedelta_seconds(dt.tzinfo.utcoffset(dt))) return timestamp