MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / __init__

Method __init__

botasaurus_api/botasaurus_api/__init__.py:24–35  ·  view source on GitHub ↗

Initializes the API client with a specified server URL and an option to create response files. :param api_url: The base URL for the API server. If not specified, defaults to "http://localhost:8000". :param create_response_files: Indicates if the client should cr

(self, api_url: Optional[str] = None, create_response_files: bool = True)

Source from the content-addressed store, hash-verified

22
23class Api:
24 def __init__(self, api_url: Optional[str] = None, create_response_files: bool = True) -> None:
25 """
26 Initializes the API client with a specified server URL and an option to create response files.
27
28 :param api_url: The base URL for the API server. If not specified, defaults to "http://localhost:8000".
29 :param create_response_files: Indicates if the client should create response files for each API call. This is useful for debugging or development purposes. Defaults to True.
30 """
31 DEFAULT_API_URL = "http://localhost:8000"
32 self._api_url = remove_after_first_slash(api_url) if api_url else DEFAULT_API_URL
33 self._create_response_files = create_response_files # Flag for creating response files
34 if not self.is_api_running():
35 raise ApiException(f"API at {self._api_url} is not running. Please check if the API is up and running.")
36
37 def _write_json(self, filename, data):
38 """

Callers

nothing calls this directly

Calls 3

is_api_runningMethod · 0.95
remove_after_first_slashFunction · 0.85
ApiExceptionClass · 0.70

Tested by

no test coverage detected