class_docstr: This class manages the querying of DBpedia and attaches the found entities to the document
class_docstr_tok: ["This","class","manages","the","querying","of","DBpedia","and","attaches","the","found","entities","to","the","document"]
docstr: Wraps a remote call to the DBpedia Spotlight API, handles the possible errors and returns the JSON response:
  - calls make_request to perform the actual request
  - hecks the response object and acts accordingly to the status code and the decided behaviour (self.raise_http_errors)
  - returns the JSON response
  
  :param doc: the document to be annotated
  :type doc: Doc
  :return: the JSON response or None in case of error and self.raise_http_errors is False
docstr_tok: ["Wraps","a","remote","call","to","the","DBpedia","Spotlight","API",",","handles","the","possible","errors","and","returns","the","JSON","response",":","-","calls","make_request","to","perform","the","actual","request","-","hecks","the","response","object","and","acts","accordingly","to","the","status","code","and","the","decided","behaviour","(","self.raise_http_errors",")","-","returns","the","JSON","response",":","param","doc",":","the","document","to","be","annotated",":","type","doc",":","Doc",":","return",":","the","JSON","response","or","None","in","case","of","error","and","self.raise_http_errors","is","False"]
code: def get_remote_response(self, doc: Doc):
      """
      Wraps a remote call to the DBpedia Spotlight API, handles the possible errors and returns the JSON response:
      - calls make_request to perform the actual request
      - hecks the response object and acts accordingly to the status code and the decided behaviour (self.raise_http_errors)
      - returns the JSON response
  
      :param doc: the document to be annotated
      :type doc: Doc
      :return: the JSON response or None in case of error and self.raise_http_errors is False
      """
      try:
          response = self.make_request(doc)
          response.raise_for_status()
      except HTTPError as e:
          # due to too many requests to the endpoint - this happens sometimes with the default public endpoint
          logger.warning(
              f"""Bad response from server, probably too many requests. Consider using your own endpoint. Document not updated.
                  {e}"""
          )
          logger.debug(str(e))
          if self.raise_http_errors:
              raise e
          return None
      except Exception as e:  # other erros
          logger.error(
              f"""Endpoint unreachable, please check your connection. Document not updated.
                  {e}"""
          )
          logger.debug(str(e))
          if self.raise_http_errors:
              raise e
          return None
  
      data = response.json()
      logger.debug(f"Received data: {data}")
      return data
  
file_path: spacy-dbpedia-spotlight/spacy_dbpedia_spotlight/entity_linker.py
imports: import concurrent.futures
  import sys
  import requests
  import spacy
  from multiprocessing.pool import ThreadPool
  from loguru import logger
  from requests import HTTPError
  from spacy import util
  from spacy.language import Language
  from spacy.tokens import Doc, Span
label_desc: Use image node_id 4 for calling the EntityLinker obj's underlying member method code with example usage: obj.get_remote_response(doc) and returns: data, None, None