MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / OpenPipe

Class OpenPipe

client-libs/python/openpipe/client.py:26–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24
25
26class OpenPipe:
27 base_client: OpenPipeApi
28
29 def __init__(
30 self,
31 api_key: typing.Union[str, None] = None,
32 base_url: typing.Union[str, None] = None,
33 timeout: typing.Union[float, None] = None,
34 ) -> None:
35 self.base_client = OpenPipeApi(
36 token="", base_url=DEFAULT_BASE_URL, timeout=timeout
37 )
38 # set API key
39 if os.environ.get("OPENPIPE_API_KEY"):
40 self.base_client._client_wrapper._token = os.environ["OPENPIPE_API_KEY"]
41 if api_key:
42 self.base_client._client_wrapper._token = api_key
43
44 # set base URL
45 if os.environ.get("OPENPIPE_BASE_URL"):
46 self.base_client._client_wrapper._base_url = os.environ["OPENPIPE_BASE_URL"]
47 if base_url:
48 self.base_client._client_wrapper._base_url = base_url
49
50 @property
51 def api_key(self) -> typing.Union[str, None]:
52 """Property getter for api_key."""
53 return self.base_client._client_wrapper._token
54
55 @api_key.setter
56 def api_key(self, value: typing.Union[str, None]) -> None:
57 """Property setter for api_key."""
58 self._api_key = value
59 if value is not None:
60 self.base_client._client_wrapper._token = value
61
62 @property
63 def base_url(self) -> typing.Union[str, None]:
64 """Property getter for base_url."""
65 return self.base_client._client_wrapper._base_url
66
67 @base_url.setter
68 def base_url(self, value: typing.Union[str, None]) -> None:
69 """Property setter for base_url."""
70 if value is not None:
71 self.base_client._client_wrapper._base_url = value
72
73 def report(
74 self,
75 *,
76 requested_at: typing.Optional[float] = OMIT,
77 received_at: typing.Optional[float] = OMIT,
78 req_payload: typing.Optional[typing.Any] = OMIT,
79 resp_payload: typing.Optional[typing.Any] = OMIT,
80 status_code: typing.Optional[float] = OMIT,
81 error_message: typing.Optional[str] = OMIT,
82 tags: typing.Optional[typing.Dict[str, ReportRequestTagsValue]] = {},
83 ) -> ReportResponse:

Callers 3

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected