Skip to content

Commit 5165354

Browse files
Testing...
1 parent 3aef19c commit 5165354

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

gitlab/client.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
import requests.utils
2424

2525
import gitlab.config
26-
from gitlab.const import * # noqa
27-
from gitlab.exceptions import * # noqa
28-
from gitlab import utils # noqa
26+
import gitlab.const
27+
import gitlab.exceptions
28+
from gitlab import utils
2929
from requests_toolbelt.multipart.encoder import MultipartEncoder
3030

3131

@@ -70,7 +70,7 @@ def __init__(
7070
per_page=None,
7171
pagination=None,
7272
order_by=None,
73-
user_agent=USER_AGENT,
73+
user_agent=gitlab.const.USER_AGENT,
7474
):
7575

7676
self._api_version = str(api_version)
@@ -227,7 +227,7 @@ def version(self):
227227

228228
return self._server_version, self._server_revision
229229

230-
@on_http_error(GitlabVerifyError)
230+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabVerifyError)
231231
def lint(self, content, **kwargs):
232232
"""Validate a gitlab CI configuration.
233233
@@ -247,7 +247,7 @@ def lint(self, content, **kwargs):
247247
data = self.http_post("/ci/lint", post_data=post_data, **kwargs)
248248
return (data["status"] == "valid", data["errors"])
249249

250-
@on_http_error(GitlabMarkdownError)
250+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabMarkdownError)
251251
def markdown(self, text, gfm=False, project=None, **kwargs):
252252
"""Render an arbitrary Markdown document.
253253
@@ -272,7 +272,7 @@ def markdown(self, text, gfm=False, project=None, **kwargs):
272272
data = self.http_post("/markdown", post_data=post_data, **kwargs)
273273
return data["html"]
274274

275-
@on_http_error(GitlabLicenseError)
275+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
276276
def get_license(self, **kwargs):
277277
"""Retrieve information about the current license.
278278
@@ -288,7 +288,7 @@ def get_license(self, **kwargs):
288288
"""
289289
return self.http_get("/license", **kwargs)
290290

291-
@on_http_error(GitlabLicenseError)
291+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
292292
def set_license(self, license, **kwargs):
293293
"""Add a new license.
294294
@@ -426,7 +426,7 @@ def _check_redirects(self, result):
426426
# Did we end-up with an https:// URL?
427427
location = item.headers.get("Location", None)
428428
if location and location.startswith("https://"):
429-
raise RedirectError(REDIRECT_MSG)
429+
raise gitlab.exceptions.RedirectError(REDIRECT_MSG)
430430

431431
def http_request(
432432
self,
@@ -547,13 +547,13 @@ def http_request(
547547
pass
548548

549549
if result.status_code == 401:
550-
raise GitlabAuthenticationError(
550+
raise gitlab.exceptions.GitlabAuthenticationError(
551551
response_code=result.status_code,
552552
error_message=error_message,
553553
response_body=result.content,
554554
)
555555

556-
raise GitlabHttpError(
556+
raise gitlab.exceptions.GitlabHttpError(
557557
response_code=result.status_code,
558558
error_message=error_message,
559559
response_body=result.content,
@@ -592,7 +592,7 @@ def http_get(self, path, query_data=None, streamed=False, raw=False, **kwargs):
592592
try:
593593
return result.json()
594594
except Exception as e:
595-
raise GitlabParsingError(
595+
raise gitlab.exceptions.GitlabParsingError(
596596
error_message="Failed to parse the server message"
597597
) from e
598598
else:
@@ -674,7 +674,7 @@ def http_post(self, path, query_data=None, post_data=None, files=None, **kwargs)
674674
if result.headers.get("Content-Type", None) == "application/json":
675675
return result.json()
676676
except Exception as e:
677-
raise GitlabParsingError(
677+
raise gitlab.exceptions.GitlabParsingError(
678678
error_message="Failed to parse the server message"
679679
) from e
680680
return result
@@ -712,7 +712,7 @@ def http_put(self, path, query_data=None, post_data=None, files=None, **kwargs):
712712
try:
713713
return result.json()
714714
except Exception as e:
715-
raise GitlabParsingError(
715+
raise gitlab.exceptions.GitlabParsingError(
716716
error_message="Failed to parse the server message"
717717
) from e
718718

@@ -732,7 +732,7 @@ def http_delete(self, path, **kwargs):
732732
"""
733733
return self.http_request("delete", path, **kwargs)
734734

735-
@on_http_error(GitlabSearchError)
735+
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabSearchError)
736736
def search(self, scope, search, **kwargs):
737737
"""Search GitLab resources matching the provided string.'
738738
@@ -792,7 +792,7 @@ def _query(self, url, query_data=None, **kwargs):
792792
try:
793793
self._data = result.json()
794794
except Exception as e:
795-
raise GitlabParsingError(
795+
raise gitlab.exceptions.GitlabParsingError(
796796
error_message="Failed to parse the server message"
797797
) from e
798798

0 commit comments

Comments
 (0)