Add external engine analysis post endpoints#81
Conversation
|
Could |
|
Hi @fitztrev, I am not sure if I understand what you mean. |
|
I mean when someone goes to use berserk in a script, they are currently able to specify a custom base_url instead of pointing to production See example here that points to |
|
@fitztrev Yes, should be no problem. That custom base url would need to be passed as an argument (custom_base_url) when calling one of the new endpoints methods (analysis, aquire_request and answer_request). |
|
I think it makes more sense to do it the same as with the tablebase or opening explorer where the custom URL can be set on the https://github.com/lichess-org/berserk/blob/master/berserk/clients/__init__.py#L91 https://github.com/lichess-org/berserk/blob/master/berserk/clients/tablebase.py Unfortunately, some external engine requests have to go against the default Lichess URL but I think it also still makes sense to use a similar pattern with a separate client that has the correct base URL set instead of passing it on every call. The ExternalEngine client could create a separate sub-client in its constructor with the external engine URL as its base URL. Or ExternalEngine could simply not subclass BaseClient and instead have two clients as attributes. I think either option is fine. Then we don't need custom URL params on any of the methods. And the default external engine URL can also be extracted to a constant at the top of the external engine file. |
|
@benediktwerner Thank you for the explanation, that makes sense and is indeed cleaner. |
51099c0 to
9739c29
Compare
Checklist when adding a new endpoint
Building on @Anupyas PR I moved the analysis endpoints into the external_engine client. I handled the different base URL with a new parameter in the Requestor methods post and request which accepts the different base url.README.mdclient.users.get_user(), Correct:client.users.get()berserk/types/, exampleCHANGELOG.mdin theTo be releasedsection (to be created if necessary)