While working with sqlalchemy backend for DB and strategy worker and Kafka backend for spider. Found out that in the file frontera.worker.server.WorkerJsonRpcService there is this function
class WorkerJsonRpcService(JsonRpcService):
def __init__(self, worker, settings):
root = RootResource()
root.putChild('status', StatusResource(worker))
root.putChild('jsonrpc', WorkerJsonRpcResource(worker))
JsonRpcService.__init__(self, root, settings)
self.worker = worker
And in the Resource class which the class where the putChild function is defined, I saw this line
def putChild(self, path: bytes, child: IResource) -> None:
if not isinstance(path, bytes):
raise TypeError(f"Path segment must be bytes, but {path!r} is {type(path)}")
So it always throws the TypeError as we send a string as first param in putChild and accept it to be bytes.
Changing the code to below works, but is not elegant as I don't wan't to modify library code just for this usecase.
root.putChild(b'status', StatusResource(worker))
root.putChild(b'jsonrpc', WorkerJsonRpcResource(worker))
Happy to raise a PR post discussion !
While working with sqlalchemy backend for DB and strategy worker and Kafka backend for spider. Found out that in the file
frontera.worker.server.WorkerJsonRpcServicethere is this functionAnd in the
Resourceclass which the class where theputChildfunction is defined, I saw this lineSo it always throws the TypeError as we send a string as first param in putChild and accept it to be bytes.
Changing the code to below works, but is not elegant as I don't wan't to modify library code just for this usecase.
Happy to raise a PR post discussion !