Skip to content

Commit

Permalink
fix: use urljoin to join endpoint to base url
Browse files Browse the repository at this point in the history
  • Loading branch information
giuppep committed Dec 27, 2021
1 parent 9df484b commit 1bb8b86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rustore/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from contextlib import ExitStack
from typing import IO, Any, Optional, Union
from urllib.parse import urljoin

from requests import PreparedRequest, Response, request
from requests.auth import AuthBase
Expand Down Expand Up @@ -54,7 +55,9 @@ def _request(self, endpoint: str, method: str, **kwargs: Any) -> Response:
if method not in VALID_REQUEST_METHODS:
raise AttributeError(f"'method' must be one of {VALID_REQUEST_METHODS}")

response = request(method, f"{self.url}/{endpoint}", auth=self._auth, **kwargs)
response = request(
method, urljoin(self.url, endpoint), auth=self._auth, **kwargs
)

if response.status_code == 500:
raise ServerError
Expand Down

0 comments on commit 1bb8b86

Please sign in to comment.