I resolved the issue. The problem lies in the following file: https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/cognitiveservices/azure-cognitiveservices-search-websearch/azure/cognitiveservices/search/websearch/operations/_web_operations.py.
I changed url = self._client.format_url(url, **path_format_arguments)
to url = path_format_arguments['Endpoint']
and the problem has been resolved. I've also submitted a PR, hoping they'll merge it asap.