def request_api(request, url_or_view_name, method='GET', data=None, params=None, verify=False):

    token = Token.objects.get(user=request.user)
    method = getattr(requests, method.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
Make a request to API internally.
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/core/utils.py/request_api