diff --git a/royalnet/network/__init__.py b/royalnet/network/__init__.py index 68e2f3c4..3c57814b 100644 --- a/royalnet/network/__init__.py +++ b/royalnet/network/__init__.py @@ -1,5 +1,6 @@ """Royalnet realated classes.""" -from .data import Data, Request +from .data import Data +from .request import Request from .package import Package from .royalnetlink import RoyalnetLink, NetworkError, NotConnectedError, NotIdentifiedError, ConnectionClosedError from .royalnetserver import RoyalnetServer diff --git a/royalnet/network/data.py b/royalnet/network/data.py index 63895037..6f8bdf46 100644 --- a/royalnet/network/data.py +++ b/royalnet/network/data.py @@ -5,21 +5,3 @@ class Data: def to_dict(self): return self.__dict__ - - -class Request(Data): - """A Royalnet request. It contains the name of the requested handler, in addition to the data.""" - - def __init__(self, handler: str, data: dict): - super().__init__() - self.handler: str = handler - self.data: dict = data - - @staticmethod - def from_dict(d: dict): - return Request(**d) - - def __eq__(self, other): - if isinstance(other, Request): - return self.handler == other.handler and self.data == other.data - return False diff --git a/royalnet/network/request.py b/royalnet/network/request.py new file mode 100644 index 00000000..257eb21e --- /dev/null +++ b/royalnet/network/request.py @@ -0,0 +1,19 @@ +from .data import Data + + +class Request(Data): + """A Royalnet request. It contains the name of the requested handler, in addition to the data.""" + + def __init__(self, handler: str, data: dict): + super().__init__() + self.handler: str = handler + self.data: dict = data + + @staticmethod + def from_dict(d: dict): + return Request(**d) + + def __eq__(self, other): + if isinstance(other, Request): + return self.handler == other.handler and self.data == other.data + return False