httprest 0.4.0__tar.gz → 0.4.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: httprest
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: A library for making simple REST-like HTTP requests
5
5
  License: MIT
6
+ License-File: LICENSE
6
7
  Author: Andrii Nechaiev
7
8
  Author-email: andrewnech@gmail.com
8
9
  Requires-Python: >=3.9,<4.0
@@ -17,12 +18,13 @@ Classifier: Programming Language :: Python :: 3.10
17
18
  Classifier: Programming Language :: Python :: 3.11
18
19
  Classifier: Programming Language :: Python :: 3.12
19
20
  Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
20
22
  Classifier: Programming Language :: Python :: 3 :: Only
21
23
  Classifier: Programming Language :: Python :: Implementation :: CPython
22
24
  Classifier: Topic :: Software Development :: Libraries
23
25
  Classifier: Topic :: Utilities
24
26
  Provides-Extra: requests-client
25
- Requires-Dist: requests (>=2.32.3,<3.0.0) ; extra == "requests-client"
27
+ Requires-Dist: requests (>=2,<3) ; extra == "requests-client"
26
28
  Project-URL: Repository, https://github.com/litteratum/httprest
27
29
  Description-Content-Type: text/markdown
28
30
 
@@ -1,5 +1,6 @@
1
1
  """API."""
2
2
 
3
+ import urllib.parse
3
4
  from typing import Optional as _Optional
4
5
  from typing import Union as _Union
5
6
 
@@ -25,13 +26,13 @@ class API:
25
26
  :param http_client: HTTP client to use for making HTTP requests.
26
27
  If not provided, the default one will be used
27
28
  """
28
- self._base_url = base_url.rstrip("/")
29
+ self._base_url = base_url.rstrip("/") + "/"
29
30
  self._http_client = http_client or _UrllibHTTPClient()
30
31
 
31
32
  def _request(
32
33
  self,
33
34
  method: str,
34
- endpoint: str,
35
+ endpoint: _Optional[str] = None,
35
36
  data: _Optional[_Union[dict, bytes]] = None,
36
37
  json: _Optional[dict] = None,
37
38
  headers: _Optional[dict] = None,
@@ -42,7 +43,7 @@ class API:
42
43
  # pylint: disable=too-many-arguments
43
44
  """Make API request.
44
45
 
45
- :param endpoint: API endpoint. Will be appended to the base URL
46
+ :param endpoint: API endpoint. Will be joined with the base URL
46
47
 
47
48
  Other parameters are the same as for the `HTTPClient.request` method
48
49
  """
@@ -57,8 +58,10 @@ class API:
57
58
  cert=cert,
58
59
  )
59
60
 
60
- def _build_url(self, endpoint: str) -> str:
61
- return f"{self._base_url}/{endpoint.strip('/')}"
61
+ def _build_url(self, endpoint: _Optional[str]) -> str:
62
+ return urllib.parse.urljoin(
63
+ self._base_url, endpoint.lstrip("/") if endpoint else ""
64
+ )
62
65
 
63
66
  def __str__(self) -> str:
64
67
  return f"{self.__class__.__name__}(base_url='{self._base_url}')"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "httprest"
3
- version = "0.4.0"
3
+ version = "0.4.2"
4
4
  description = "A library for making simple REST-like HTTP requests"
5
5
  authors = ["Andrii Nechaiev <andrewnech@gmail.com>"]
6
6
  readme = "README.md"
@@ -14,6 +14,8 @@ classifiers=[
14
14
  "Programming Language :: Python :: 3.9",
15
15
  "Programming Language :: Python :: 3.11",
16
16
  "Programming Language :: Python :: 3.12",
17
+ "Programming Language :: Python :: 3.13",
18
+ "Programming Language :: Python :: 3.14",
17
19
  "Programming Language :: Python :: 3 :: Only",
18
20
  "Programming Language :: Python :: Implementation :: CPython",
19
21
  "Topic :: Software Development :: Libraries",
@@ -25,7 +27,7 @@ classifiers=[
25
27
 
26
28
  [tool.poetry.dependencies]
27
29
  python = "^3.9"
28
- requests = {version = "^2.32.3", optional = true}
30
+ requests = {version = "^2", optional = true}
29
31
 
30
32
  [tool.poetry.extras]
31
33
  requests-client = ["requests"]
@@ -35,15 +37,15 @@ pytest = "^8.3.2"
35
37
  pytest-cov = "^5.0.0"
36
38
  responses = "^0.25.3"
37
39
 
38
-
39
40
  [tool.poetry.group.lint.dependencies]
40
- black = {version = "^24.8.0", python = "3.11"}
41
- pylint = {version = "^3.2.6", python = "3.11"}
41
+ black = {version = "^25", python = "3.11"}
42
+ pylint = {version = "^4", python = "3.11"}
42
43
  flake8 = {version = "^7.1.1", python = "3.11"}
43
- flake8-bugbear = {version = "^24.8.19", python = "3.11"}
44
+ flake8-bugbear = {version = "^25", python = "3.11"}
44
45
  mypy = {version = "^1.11.1", python = "3.11"}
45
46
  pydocstyle = {version = "^6.3.0", python = "3.11"}
46
47
  types-requests = "^2.32.0.20240914"
48
+ pip-audit = "^2.9.0"
47
49
 
48
50
  [build-system]
49
51
  requires = ["poetry-core"]
@@ -82,7 +84,8 @@ good-names = [
82
84
  [tool.pylint.'MESSAGES CONTROL']
83
85
  disable = [
84
86
  "fixme",
85
- "import-error"
87
+ "import-error",
88
+ "too-many-positional-arguments",
86
89
  ]
87
90
 
88
91
  [tool.pylint.'VARIABLES']
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes