<filename>app/views.py
from django.shortcuts import render,HttpResponse
import requests

# Create your views here.
def helloworldview(request):
    data = True
    result = None
    statewisesummary = None
    India = None
    summary= None
    date=None
    while(data):
        try:
            result = requests.get('https://api.rootnet.in/covid19-in/stats/latest.json')
            json = result.json()
            statewisesummary = json['data']
            India = statewisesummary['summary']
            summary = statewisesummary['regional']
            date= json['lastOriginUpdate']
            print(summary)
            data = False
        except:
            data = True   
    return render(request,'helloworld.html',{'summary':summary,'date':date,'India':India})

def globalview(request):
    data = True
    result = None
    globalsummary = None
    countries=None
    
    while(data):
        try:
            result = requests.get('https://api.covid19api.com/summary')
            json = result.json()
            globalsummary = json['Global']
            countries = json['Countries']
            data = False
        except:
            data = True   
    return render(request,'global.html',{'globalsummary':globalsummary,'countries':countries})

def notifyview(request):
    data = True
    result = None
    notify = None
    notifications = None

    while(data):
        try:
            result = requests.get('https://api.rootnet.in/covid19-in/notifications')
            json = result.json()
            notify = json['data']
            notifications = notify['notifications']
            data = False
        except:
            data = True
    return render(request,'notify.html',{'notifications':notifications})                


<filename>app/views.py
from django.shortcuts import render,HttpResponse
import requests

# Create your views here.
def helloworldview(request):
    data = True
    result = None
    statewisesummary = None
    India = None
    summary= None
    date=None
    while(data):
        try:
            result = requests.get('https://api.rootnet.in/covid19-in/stats/latest.json')
            json = result.json()
            statewisesummary = json['data']
            India = statewisesummary['summary']
            summary = statewisesummary['regional']
            date= json['lastOriginUpdate']
            print(summary)
            data = False
        except:
            data = True   
    return render(request,'helloworld.html',{'summary':summary,'date':date,'India':India})

def globalview(request):
    data = True
    result = None
    globalsummary = None
    countries=None
    
    while(data):
        try:
            result = requests.get('https://api.covid19api.com/summary')
            json = result.json()
            globalsummary = json['Global']
            countries = json['Countries']
            data = False
        except:
            data = True   
    return render(request,'global.html',{'globalsummary':globalsummary,'countries':countries})

def notifyview(request):
    data = True
    result = None
    notify = None
    notifications = None

    while(data):
        try:
            result = requests.get('https://api.rootnet.in/covid19-in/notifications')
            json = result.json()
            notify = json['data']
            notifications = notify['notifications']
            data = False
        except:
            data = True
    return render(request,'notify.html',{'notifications':notifications})                


# Create your views here.