Skip to content

Commit 2717a1b

Browse files
author
Liora Milbaum
committed
feat: Bootstrapping the http_engines concept
1 parent 0ecf3bb commit 2717a1b

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

gitlab/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import gitlab.config
1515
import gitlab.const
1616
import gitlab.exceptions
17-
from gitlab import utils
17+
from gitlab import http_engines, utils
1818

1919
REDIRECT_MSG = (
2020
"python-gitlab detected a {status_code} ({reason!r}) redirection. You must update "
@@ -73,7 +73,12 @@ def __init__(
7373
user_agent: str = gitlab.const.USER_AGENT,
7474
retry_transient_errors: bool = False,
7575
keep_base_url: bool = False,
76+
**kwargs: Any,
7677
) -> None:
78+
"""
79+
kwargs:-
80+
:param http_engine: (optional). Engine that will be used to make http requests
81+
"""
7782

7883
self._api_version = str(api_version)
7984
self._server_version: Optional[str] = None
@@ -191,6 +196,9 @@ def __init__(
191196
self.statistics = objects.ApplicationStatisticsManager(self)
192197
"""See :class:`~gitlab.v4.objects.ApplicationStatisticsManager`"""
193198

199+
http_engine = kwargs.pop("http_engine", http_engines.DefaultEngine)
200+
self.http_engine = http_engine(**kwargs)
201+
194202
def __enter__(self) -> "Gitlab":
195203
return self
196204

gitlab/http_engines/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
Defines http engines for processing http requests
3+
"""
4+
5+
from .requests_engine import RequestsEngine
6+
7+
DefaultEngine = RequestsEngine
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from typing import Any
2+
3+
4+
class RequestsEngine:
5+
def __init__(self, **kwargs: Any) -> None:
6+
pass

0 commit comments

Comments
 (0)