MCPcopy Create free account
hub / github.com/datapane/datapane / http_date

Function http_date

python-client/src/datapane/_vendor/bottle.py:2950–2963  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

2948
2949
2950def http_date(value):
2951 if isinstance(value, basestring):
2952 return value
2953 if isinstance(value, datetime):
2954 # aware datetime.datetime is converted to UTC time
2955 # naive datetime.datetime is treated as UTC time
2956 value = value.utctimetuple()
2957 elif isinstance(value, datedate):
2958 # datetime.date is naive, and is treated as UTC time
2959 value = value.timetuple()
2960 if not isinstance(value, (int, float)):
2961 # convert struct_time in UTC to UNIX timestamp
2962 value = calendar.timegm(value)
2963 return email.utils.formatdate(value, usegmt=True)
2964
2965
2966def parse_date(ims):

Callers 2

BaseResponseClass · 0.85
set_cookieMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected