Sparql module

Request

class src.sparql.request.RequestHandler(config: Config, logger: Logger)[source]

Bases: object

Wrapper around requests library that has some extra functionality that helps to connect with the sparql endpoint

_internal_request(query: str, endpoint: EndpointType)[source]

Internal request function that has extra error handling

Parameters:
  • query – query to execute

  • endpoint – endpoint to communicate with

Returns:

the response from the request

post2df(query: str, endpoint: EndpointType | None = None) DataFrame[source]

Funciton that takes in the query, executes it and respons with a dataframe output

Parameters:
  • query – query to execute

  • endpoint – the endpoint to use

Returns:

the parsed pandas dataframe based on the response

post2json(query: str, endpoint: EndpointType | None = None)[source]

Function that takes in the query, executes it and responds with the json output.

Parameters:
  • query – the query to execute

  • endpoint – the endpoint to use

Returns:

returns the json output