MCPcopy Index your code
hub / github.com/AgentOps-AI/agentops / prepare_headers

Method prepare_headers

agentops/client/api/versions/v4.py:33–52  ·  view source on GitHub ↗

Prepare headers for API requests. Args: custom_headers: Additional headers to include Returns: Headers dictionary with standard headers and any custom headers

(self, custom_headers: Optional[Dict[str, str]] = None)

Source from the content-addressed store, hash-verified

31 self.auth_token = token
32
33 def prepare_headers(self, custom_headers: Optional[Dict[str, str]] = None) -> Dict[str, str]:
34 """
35 Prepare headers for API requests.
36
37 Args:
38 custom_headers: Additional headers to include
39 Returns:
40 Headers dictionary with standard headers and any custom headers
41 """
42 headers = {
43 "User-Agent": f"agentops-python/{get_agentops_version() or 'unknown'}",
44 }
45
46 # Only add Authorization header if we have a token
47 if self.auth_token:
48 headers["Authorization"] = f"Bearer {self.auth_token}"
49
50 if custom_headers:
51 headers.update(custom_headers)
52 return headers
53
54 def post(self, path: str, body: Union[str, bytes], headers: Optional[Dict[str, str]] = None) -> requests.Response:
55 """

Callers 4

postMethod · 0.95
upload_objectMethod · 0.95
upload_logfileMethod · 0.95
fetch_auth_tokenMethod · 0.45

Calls 1

get_agentops_versionFunction · 0.90

Tested by

no test coverage detected