code: def get(self, url, store_on_error=False, xpath=None, rate_limit=None, log_hits=True, log_misses=True):
          try:
              cached = self._query(url, xpath).one()
              if log_hits:
                  config.logger.info("Request cache hit: " + url)
              if cached.status_code != requests.codes.ok:
                  raise RuntimeError("Cached request returned an error, code " + str(cached.status_code))
          except NoResultFound:
              if log_misses:
                  config.logger.info("Request cache miss: " + url)
              try:
                  if rate_limit is not None and self.last_query is not None:
                      to_sleep = rate_limit - (datetime.datetime.now() - self.last_query).total_seconds()
                      if to_sleep > 0:
                          time.sleep(to_sleep)
                  self.last_query = datetime.datetime.now()
                  response = requests.get(url)
                  status_code = response.status_code
                  content = response.text
                  response.close()
                  if xpath is not None:
                      doc = html.fromstring(content)
                      nodes = doc.xpath(xpath)
                      if len(nodes) == 0:
                          content = "xpath not found: " + xpath
                          status_code = ERROR_XPATH_NOT_FOUND
                      else:
                          content = html.tostring(nodes[0], encoding='unicode')
              except requests.ConnectionError as e:
                  status_code = ERROR_CONNECTION_ERROR
                  content = str(e)
              cached = CachedRequest(url=str(url),
                                     content=content,
                                     status_code=status_code,
                                     xpath=xpath,
                                     queried_on=datetime.datetime.now())
              if status_code == requests.codes.ok or store_on_error:
                  self.session.add(cached)
                  self.session.commit()
              if status_code != requests.codes.ok:
                  raise RuntimeError("Error processing the request, " + str(status_code) + ": " + content)
          return cached.content