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)
| 38 | self.last_response: Optional[requests.Response] = None |
| 39 | |
| 40 | def prepare_headers(self, custom_headers: Optional[Dict[str, str]] = None) -> Dict[str, str]: |
| 41 | """ |
| 42 | Prepare headers for API requests. |
| 43 | |
| 44 | Args: |
| 45 | custom_headers: Additional headers to include |
| 46 | |
| 47 | Returns: |
| 48 | Headers dictionary with standard headers and any custom headers |
| 49 | """ |
| 50 | headers = { |
| 51 | "Content-Type": "application/json", |
| 52 | "Connection": "keep-alive", |
| 53 | "Keep-Alive": "timeout=10, max=1000", |
| 54 | "User-Agent": f"agentops-python/{get_agentops_version() or 'unknown'}", |
| 55 | } |
| 56 | |
| 57 | if custom_headers: |
| 58 | headers.update(custom_headers) |
| 59 | |
| 60 | return headers |
| 61 | |
| 62 | def _get_full_url(self, path: str) -> str: |
| 63 | """ |