MCPcopy Index your code
hub / github.com/agentrpc/agentrpc / get

Method get

sdk-python/src/agentrpc/http_client.py:162–190  ·  view source on GitHub ↗

Make a GET request to the API. Args: path: The API path. params: Query parameters. Returns: The API response. Raises: AgentRPCError: If the request fails for any reason.

(self, path: str, params: Optional[Dict[str, Any]] = None)

Source from the content-addressed store, hash-verified

160 )
161
162 def get(self, path: str, params: Optional[Dict[str, Any]] = None) -> Any:
163 """Make a GET request to the API.
164
165 Args:
166 path: The API path.
167 params: Query parameters.
168
169 Returns:
170 The API response.
171
172 Raises:
173 AgentRPCError: If the request fails for any reason.
174 """
175 url = f"{self.endpoint}{path}"
176
177 try:
178 response = requests.get(url, params=params, headers=self.headers)
179 response.raise_for_status()
180 return response.json()
181 except requests.HTTPError as e:
182 raise AgentRPCError(
183 f"HTTP error: {e.response.status_code} - {e.response.text}",
184 status_code=e.response.status_code,
185 response=e.response.text,
186 )
187 except requests.RequestException as e:
188 raise AgentRPCError(f"Request error: {str(e)}")
189 except Exception as e:
190 raise AgentRPCError(f"Unexpected error: {str(e)}")
191
192 def post(
193 self, path: str, data: Dict[str, Any], params: Optional[Dict[str, Any]] = None

Callers 15

list_toolsMethod · 0.95
get_jobMethod · 0.95
get_toolsMethod · 0.80
execute_toolMethod · 0.80
get_toolsMethod · 0.80
get_toolsMethod · 0.80
create_and_poll_jobMethod · 0.80
test_client.pyFile · 0.80
getErrorConstructorFunction · 0.80
pollIterationMethod · 0.80
mainFunction · 0.80

Calls 1

AgentRPCErrorClass · 0.70

Tested by

no test coverage detected