from django.http.response import JsonResponse
import requests
import json


def get_segments(request):
    url = "https://app.najva.com/api/v1/websites/65b3a75a-d634-48c5-824f-c80c703534af/segments/"

    headers = {
        'content-type': "application/json",
        'authorization': "Token 982c17c1d460fec1eef6270c7d6550e3b9b33d2d",
        'cache-control': "no-cache",
    }

    response = requests.request('GET', url=url, headers=headers)
    resp = json.loads(response.text.encode('utf8'))
    return JsonResponse(resp, safe=False)
