def tasks(self, request):
   """Lists a given bot's tasks within the specified date range."""
   logging.info('%s', request)
   try:
     start = message_conversion.epoch_to_datetime(request.start)
     end = message_conversion.epoch_to_datetime(request.end)
     run_results, cursor, more = task_result.get_run_results(
         request.cursor, request.bot_id, start, end, request.limit)
   except ValueError as e:
     raise endpoints.BadRequestException(
         'Inappropriate limit for bots/list: %s' % e)
   return swarming_rpcs.BotTasks(
       cursor=cursor.urlsafe() if cursor and more else None,
       items=[message_conversion.task_result_to_rpc(r) for r in run_results],
       now=utils.utcnow())
 def tasks(self, request):
   """Lists a given bot's tasks within the specified date range."""
   try:
     start, end = _get_range(request)
     run_results, cursor, more = task_result.get_run_results(
         request.cursor, request.bot_id, start, end, request.batch_size)
   except ValueError as e:
     raise endpoints.BadRequestException(
         'Inappropriate batch_size for bots/list: %s' % e)
   result_list = [message_conversion.task_run_result_from_dict(
       utils.to_json_encodable(run_result)) for run_result in run_results]
   response = swarming_rpcs.BotTasks(
       cursor=cursor.urlsafe() if cursor and more else None,
       items=result_list,
       now=utils.utcnow())
   return response