def api_call(request, format="json"):
  servertime = api.utcnow()
  try:
    kwargs = oauth_util.get_method_kwargs(request)
    json_params = kwargs.pop('json_params', None)
    if json_params:
      parsed = simplejson.loads(json_params)
      # Turn the keys from unicode to str so that they can be used as method
      # parameters.
      kwargs.update(
          dict([(str(k), v) for k, v in parsed.iteritems()]))
    method = kwargs.pop('method', '').replace('.', '_')
    if method == 'presence_send':
      method = 'post'

    if not method:
      raise exception.ApiException(exception.NO_METHOD, "No method specified")


    # Allows us to turn off authentication for testing purposes
    if not settings.API_DISABLE_VERIFICATION:
      api_user = request.user
    else:
      api_user = api.ROOT

    method_ref = api.PublicApi.get_method(method, api_user)
    if not method_ref:
      raise exception.ApiException(exception.INVALID_METHOD,
                         'Invalid method: %s' % method)

    if not api_user:
      raise exception.ApiException(0x00, 'Invalid API user')

    if getattr(api_user, 'legacy', None) and method == 'post':
      kwargs['nick'] = api_user.nick

    rv = method_ref(api_user, **kwargs)
    if rv is None:
      raise exception.ApiException(0x00, 'method %s returned None'%(method))
    return render_api_response(rv, format, servertime=servertime)
  except oauth_util.OAuthError, e:
    exc = exception.ApiException(exception.OAUTH_ERROR, e.message)
    return render_api_response(exc, format)
  except exception.ApiException, e:
    return render_api_response(e, format)
  except TypeError, e:
    exc = exception.ApiException(exception.INVALID_ARGUMENTS, str(e))
    return render_api_response(exc, format)
  except:
    exception.handle_exception(request)
    return render_api_response(request.errors[0], format)

  # some error happened
  return render_api_response(request.errors[0], format)
set whether or not the client perform auto-retry
dataset/ETHPy150Open CollabQ/CollabQ/api/views.py/api_call--crossover with--dataset/ETHPy150Open aliyun/aliyun-openapi-python-sdk/aliyun-python-sdk-core/aliyunsdkcore/client.py/AcsClient.set_auto_retry