lcu_connector.connection

class Connection

Represents a connection object that allows for sending requests to the Riot API.

Attributes

  • __session (Session]): A session object for sending HTTP requests.
  • __riotSSL (RiotSSL): An SSL object for handling Riot SSL certificate.
  • __ssl (Path): The path to the SSL certificate file.

Connection.__init__()

Initializes the Connection object.

def __init__(self) -> None:

Connection.start()

Starts a new session with the provided headers and SSL verification.

def start(self) -> None:

Connection.stop()

Closes the session if it exists and sets it to None.

def stop(self):

Raises

  • SessionError: If there is no active session.

Connection.get()

Sends a GET request to the specified API URL and returns the response.

def get(self, api_url: str) -> Response:

Args

  • api_url (str): The URL of the API to send the request to.

Returns

  • Response: The response object from the GET request.

Connection.post()

Sends a POST request with the given data to the specified API URL using the active session.

def post(self, api_url: str, data: Dict) -> Response:

Args

  • api_url (str): The URL of the API to send the request to.
  • data (Dict): The data to send with the POST request.

Returns

  • Response: The response object containing the server's response to the request.

Connection.put()

Sends a PUT request with the given data to the specified API URL using the active session.

def put(self, api_url: str, data: Dict) -> Response:

Args

  • api_url (str): The URL of the API endpoint.
  • data (Dict): The data to be sent in the request.

Returns

  • Response: The response object from the request.

Connection.delete()

Sends a DELETE request to the specified API URL using the active session.

def delete(self, api_url: str) -> Response:

Args

  • api_url (str): The URL of the API endpoint to delete.

Returns

  • Response: The response object from the DELETE request.

Connection.connected()

Checks if the connection is established.

@property
def connected(self) -> bool:

Args

  • self

Returns

  • bool: Returns True if the connection is established, otherwise False.