def parsehttpdate(string_):
 try:
  t = time.strptime(string_, '%a, %d %b %Y %H:%M:%S %Z')
 except ValueError:
  return None
 return datetime.datetime(*t[:6])

def parsehttpdate ( string_ ) : try : t = time . strptime ( string_ , '%a, %d %b %Y %H:%M:%S %Z' ) except ValueError : return None return datetime . datetime ( * t [ : 6 ] )
parses an http date into a datetime object .