Designing a GEO location API

You are designing a GEO Location API that provides geo location information based on IP addresses, using Django REST API. You are performing a GET request to the URL and reading the data in JSON format into the geodata variable, in the file.

Which of the following options will best fit the missing line of code, XXX and YYY, to perform the action given in the above context?

from django.shortcuts import render

import requests

def home(request):



return render(request, ‘core/home.html’, {

‘ip’: geodata[‘ip’],

‘country’: geodata[‘country_name’]


  1. XXX: response =‘’)

YYY: geodata = response.json()

2.XXX: geodata = response.json()

YYY: response = requests.get(‘’)

3.XXX: geo = response.json()

YYY: response = requests.get(‘’)

4.XXX: response = requests.get(‘’)

YYY: geodata = response.json()

Related Posts

Close Bitnami banner