From 1e629af73e312fea39522334869c3a9b7e6085b9 Mon Sep 17 00:00:00 2001 From: Nejc Habjan Date: Mon, 30 Jan 2023 20:57:54 +0100 Subject: [PATCH] chore: make backends private --- .../{http_backends => _backends}/__init__.py | 0 .../requests_backend.py | 0 gitlab/client.py | 20 +++++++++---------- 3 files changed, 10 insertions(+), 10 deletions(-) rename gitlab/{http_backends => _backends}/__init__.py (100%) rename gitlab/{http_backends => _backends}/requests_backend.py (100%) diff --git a/gitlab/http_backends/__init__.py b/gitlab/_backends/__init__.py similarity index 100% rename from gitlab/http_backends/__init__.py rename to gitlab/_backends/__init__.py diff --git a/gitlab/http_backends/requests_backend.py b/gitlab/_backends/requests_backend.py similarity index 100% rename from gitlab/http_backends/requests_backend.py rename to gitlab/_backends/requests_backend.py diff --git a/gitlab/client.py b/gitlab/client.py index e5daf18e9..5e6c71af0 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -12,7 +12,7 @@ import gitlab.config import gitlab.const import gitlab.exceptions -from gitlab import http_backends, utils +from gitlab import _backends, utils REDIRECT_MSG = ( "python-gitlab detected a {status_code} ({reason!r}) redirection. You must update " @@ -52,9 +52,9 @@ class Gitlab: keep_base_url: keep user-provided base URL for pagination if it differs from response headers - Keyward Args: - requests.Session session: Http Requests Session - RequestsBackend http_backend: Backend that will be used to make http requests + Keyword Args: + requests.Session session: HTTP Requests Session + RequestsBackend backend: Backend that will be used to make http requests """ def __init__( @@ -99,11 +99,11 @@ def __init__( self._set_auth_info() #: Create a session object for requests - http_backend: Type[http_backends.DefaultBackend] = kwargs.pop( - "http_backend", http_backends.DefaultBackend + _backend: Type[_backends.DefaultBackend] = kwargs.pop( + "backend", _backends.DefaultBackend ) - self.http_backend = http_backend(**kwargs) - self.session = self.http_backend.client + self._backend = _backend(**kwargs) + self.session = self._backend.client self.per_page = per_page self.pagination = pagination @@ -716,7 +716,7 @@ def http_request( retry_transient_errors = self.retry_transient_errors # We need to deal with json vs. data when uploading files - json, data, content_type = self.http_backend.prepare_send_data( + json, data, content_type = self._backend.prepare_send_data( files, post_data, raw ) opts["headers"]["Content-type"] = content_type @@ -724,7 +724,7 @@ def http_request( cur_retries = 0 while True: try: - result = self.http_backend.http_request( + result = self._backend.http_request( method=verb, url=url, json=json,