

def request_api(request, url_or_view_name, method='GET', data=None, params=None, verify=False):
    " Make a request to API internally.\n        Use 'request.user' for authentication.\n        Return a JSON response.\n    "
    token = Token.objects.get(user=request.user)
    method = getattr(requests, request.lower())
    if url_or_view_name.startswith('http'):
        url = url_or_view_name
    else:
        url = request.build_absolute_uri(reverse(url_or_view_name))
    response = method(url, headers={
        'Authorization': ('Token %s' % token.key),
    }, data=data, params=params, verify=verify)
    setattr(response, 'total', int(response.headers.get('X-Result-Count', 0)))
    return response

dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/core/utils.py request_api/VarMisuse@51/100 `method`->`request`