title: maximum recursion depth exceeded requests
body: <p>Currently new to python/django so forgive me if this is a simple question.</p>
  
  <p>I am using requests to download a json file and am trying to parse/display the values in a template.</p>
  
  <p>I receive the following error:
  `maximum recursion depth exceeded while calling a Python object</p>
  
  <p>Code is below:</p>
  
  <pre><code>from django import template
  from django.template.loader import render_to_string
  from wagtail.wagtailcore.blocks.base import Block
  from django.http import HttpResponse
  from django.shortcuts import render
  from django.template import loader
  
  import datetime
  import urllib
  import json
  import requests
  import requests_cache
  
  requests_cache.install_cache('demo_cache')
  
  register = template.Library()
  
  # Advert snippets
  @register.inclusion_tag('swd/templates/adverts.html', takes_context=True)
  def adverts(context):
      return {
          'adverts': Advert.objects.all(),
          'request': context['request'],
      }
  
  #Socialboard
  #Pinterest
  @register.inclusion_tag('blocks/socialboard.html')
  def get_pinterest_pins():
      req = requests.get(URL)
      req_json = json.loads(req.content)
  
      for key, value in req_json.items():
          print (key, value)
  
  # Related within article
  @register.filter
  def inject_related_after_paragraph(value, arg):
      related_list = render_to_string("related.list.html")
      paragraphs = value.split('&lt;/p&gt;')
  
      if arg &lt; len(paragraphs):
          paragraphs[arg] = related_list + paragraphs[arg]
          value = '&lt;/p&gt;'.join(paragraphs)
      return value
  
  @register.filter
  def inject_advert_after_paragraph(value, arg):
      advert = render_to_string("adverts.html")
      paragraphs = value.split('&lt;/p&gt;')
  
      if arg &lt; len(paragraphs):
          paragraphs[arg] = advert + paragraphs[arg]
          value = '&lt;/p&gt;'.join(paragraphs)
  
      return value
  </code></pre>
  
  <p>This loops through the URL ok but continously until a point that it times out.</p>