MCPcopy
hub / github.com/Skyvern-AI/skyvern / make_request

Function make_request

scripts/test_persistent_browsers.py:24–43  ·  view source on GitHub ↗

Helper function to make API requests

(method: str, endpoint: str, data: Optional[dict[str, Any]] = None)

Source from the content-addressed store, hash-verified

22
23
24def make_request(method: str, endpoint: str, data: Optional[dict[str, Any]] = None) -> requests.Response:
25 """Helper function to make API requests"""
26 url = f"{API_BASE_URL}{endpoint}"
27 try:
28 response = requests.request(method=method, url=url, headers=HEADERS, json=data)
29 response.raise_for_status()
30 return response
31 except requests.exceptions.RequestException as e:
32 print(f"\nRequest failed: {method} {url}")
33 if hasattr(e, "response") and e.response is not None:
34 print(f"Status code: {e.response.status_code}")
35 try:
36 error_detail = e.response.json() if e.response is not None else str(e)
37 print(f"Error details: {json.dumps(error_detail, indent=2)}")
38 except json.JSONDecodeError:
39 print(f"Raw error response: {e.response.text}")
40 else:
41 print("Status code: N/A")
42 print(f"Error details: {str(e)}")
43 raise
44
45
46def list_sessions() -> None:

Callers 8

list_sessionsFunction · 0.85
create_browser_sessionFunction · 0.85
get_sessionFunction · 0.85
close_all_sessionsFunction · 0.85
close_sessionFunction · 0.85
create_taskFunction · 0.85
create_workflow_runFunction · 0.85
create_cruiseFunction · 0.85

Calls 3

dumpsMethod · 0.80
requestMethod · 0.45
jsonMethod · 0.45

Tested by

no test coverage detected