title: How do I structure my view for sending an api get request in Django?
body: <p>I am sending a get request in my view and then using the response to fill my database and I need some confirmation on the following:</p>
  
  <p>should i make an api call inside of a view?</p>
  
  <p>what should that view response be?</p>
  
  <p>if i have done it wrong then what would be the right way to send get requests in Django?</p>
  
  <pre><code>my_app/views.py
  
  class api(APIView):
    template_name = 'payment/api.html'
  
    def get(self, request):
      #I SEND THE GET REQUEST HERE
      config = configparser.ConfigParser()
      config.read('config.ini')
      r = requests.get(config['DEFAULT']['api'])
      response = r.json()
  
      #HERE I FILTER THE RESPONSE AND PUT IN A DB
      for item in response:
        if 'Covered Recipient Physician' in item.values():
          person, _ = models.Person.objects.get_or_create(
          profile_id = int(item['physician_profile_id']),
          first_name = item['physician_first_name'].lower(),
          last_name = item['physician_last_name'].lower()
          )
           address, _ = models.Address.objects.get_or_create(
           business_street = 
  item['recipient_primary_business_street_address_line1'].lower(),
        city = item['recipient_city'].lower(),
        state = item['recipient_state'].lower(),
        country = item['recipient_country'].lower()
      )
      business, _ = models.Business.objects.get_or_create(
        business = item['submitting_applicable_manufacturer_or_applicable_gpo_name'].lower(),
      )
      business_address_link = models.Business_address_link.objects.create(
        business = business,
        address = address
      )
      business_address_link.save()
      payment = models.Payment.objects.create(
        record_id = int(item['record_id']),
        amount = float(item['total_amount_of_payment_usdollars']),
        date = item['date_of_payment'],
        number_of_payments = int(item['number_of_payments_included_in_total_amount']),
        payment_form = item['form_of_payment_or_transfer_of_value'],
        nature_of_payment = item['nature_of_payment_or_transfer_of_value']
      )
      payment.save()
      person_payment_information = models.Person_payment_information.objects.create(
        person = person,
        business_address_link = business_address_link,
        payment = payment
      )
      person_payment_information.save()
  </code></pre>