Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Fix building URL in HTTPClient (#652)
Browse files Browse the repository at this point in the history
Fixes #649
  • Loading branch information
aminalaee authored Apr 19, 2023
1 parent 462384e commit 3013d8b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mlem/runtime/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from abc import ABC, abstractmethod
from typing import Any, BinaryIO, Callable, ClassVar, Optional
from urllib.parse import urljoin

import requests
from pydantic import BaseModel, parse_obj_as
Expand Down Expand Up @@ -180,7 +181,7 @@ def base_url(self):
return f"{prefix}{self.host}"

def _interface_factory(self) -> InterfaceDescriptor:
resp = requests.get(f"{self.base_url}/interface.json")
resp = requests.get(urljoin(self.base_url, "interface.json"))
if resp.status_code != 200:
try:
resp.raise_for_status()
Expand All @@ -193,7 +194,7 @@ def _interface_factory(self) -> InterfaceDescriptor:
def _call_method(
self, name: str, args: Any, return_raw: bool
): # pylint: disable=R1710
ret = requests.post(f"{self.base_url}/{name}", json=args)
ret = requests.post(urljoin(self.base_url, name), json=args)
if ret.status_code == 200: # pylint: disable=R1705
if return_raw:
return ret.content
Expand All @@ -205,7 +206,7 @@ def _call_method(
return None

def _call_method_binary(self, name: str, arg: Any, return_raw: bool):
ret = requests.post(f"{self.base_url}/{name}", files={"file": arg})
ret = requests.post(urljoin(self.base_url, name), files={"file": arg})
if ret.status_code == 200: # pylint: disable=R1705
if return_raw:
return ret.content # TODO: change to buffer
Expand Down

0 comments on commit 3013d8b

Please sign in to comment.