code: def _get_json(self, model, space=None, rel_path=None, extra_params=None, get_all=None):
          if space is None and model not in (Space, Event):
              raise Exception(
                  'In general, `API._get_json` should always '
                  'be called with a `space` argument.'
              )
          if not extra_params:
              extra_params = {}
          extra_params['page'] = extra_params.get('page', 1)
          url = '{0}/{1}/{2}.json?{3}'.format(
              settings.API_ROOT_PATH,
              settings.API_VERSION,
              rel_path or model.rel_path,
              urllib.urlencode(extra_params),
          )
          if self.cache_responses and url in self.cache:
              response = self.cache[url]
          else:
              headers = {
                  'X-Api-Key': self.key,
                  'X-Api-Secret': self.secret,
              }
              response = self.session.get(url=url, headers=headers)
              if self.cache_responses:
                  self.cache[url] = response
          if response.status_code == 200:
              results = []
              json_response = response.json()
              for obj in json_response:
                  instance = model(data=obj)
                  instance.api = self
                  if space:
                      instance.space = space
                  results.append(instance)
              per_page = extra_params.get('per_page', None)
              if (
                  get_all
                  and per_page
                  and len(json_response)
                  and per_page == len(json_response)
              ):
                  extra_params['page'] += 1
                  results = results + self._get_json(model, space, rel_path, extra_params, get_all=get_all)
              return results
          elif response.status_code == 204:
              return []
          else:
              raise Exception(
                  'Code {0} returned from `{1}`. Response text: "{2}".'.format(
                      response.status_code,
                      url,
                      response.text
                  )
              )