Skip to content

Commit

Permalink
Return back session object, use session.request instead of session.se…
Browse files Browse the repository at this point in the history
…nd(prepared_request)
  • Loading branch information
alexkuzmik committed Nov 30, 2023
1 parent a0e9bb2 commit 1ecf7ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/comet_llm/experiment_api/comet_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class CometAPIClient:
def __init__(self, api_key: str, comet_url: str):
self._headers = {"Authorization": api_key}
self._comet_url = comet_url
self._session = requests.Session()

def create_experiment(
self,
Expand Down Expand Up @@ -121,8 +122,12 @@ def log_experiment_other(

def _request(self, method: str, path: str, *args, **kwargs) -> ResponseContent: # type: ignore
url = urllib.parse.urljoin(self._comet_url, path)
response = requests.request(method, url, headers=self._headers, *args, **kwargs)
# request = requests.Request(method, url, headers=self._headers, *args, **kwargs)

# response = self._session.send(request.prepare())
response = self._session.request(
method=method, url=url, headers=self._headers, *args, **kwargs
)
response.raise_for_status()

return response.json()
Expand Down

0 comments on commit 1ecf7ac

Please sign in to comment.