2323import requests .utils
2424
2525import 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
2929from requests_toolbelt .multipart .encoder import MultipartEncoder
3030
3131
@@ -70,7 +70,7 @@ def __init__(
7070per_page = None ,
7171pagination = None ,
7272order_by = None ,
73- user_agent = USER_AGENT ,
73+ user_agent = gitlab . const . USER_AGENT ,
7474 ):
7575
7676self ._api_version = str (api_version )
@@ -227,7 +227,7 @@ def version(self):
227227
228228return self ._server_version ,self ._server_revision
229229
230- @on_http_error (GitlabVerifyError )
230+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabVerifyError )
231231def lint (self ,content ,** kwargs ):
232232"""Validate a gitlab CI configuration.
233233
@@ -247,7 +247,7 @@ def lint(self, content, **kwargs):
247247data = self .http_post ("/ci/lint" ,post_data = post_data ,** kwargs )
248248return (data ["status" ]== "valid" ,data ["errors" ])
249249
250- @on_http_error (GitlabMarkdownError )
250+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabMarkdownError )
251251def 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):
272272data = self .http_post ("/markdown" ,post_data = post_data ,** kwargs )
273273return data ["html" ]
274274
275- @on_http_error (GitlabLicenseError )
275+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabLicenseError )
276276def get_license (self ,** kwargs ):
277277"""Retrieve information about the current license.
278278
@@ -288,7 +288,7 @@ def get_license(self, **kwargs):
288288 """
289289return self .http_get ("/license" ,** kwargs )
290290
291- @on_http_error (GitlabLicenseError )
291+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabLicenseError )
292292def 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?
427427location = item .headers .get ("Location" ,None )
428428if location and location .startswith ("https://" ):
429- raise RedirectError (REDIRECT_MSG )
429+ raise gitlab . exceptions . RedirectError (REDIRECT_MSG )
430430
431431def http_request (
432432self ,
@@ -547,13 +547,13 @@ def http_request(
547547pass
548548
549549if result .status_code == 401 :
550- raise GitlabAuthenticationError (
550+ raise gitlab . exceptions . GitlabAuthenticationError (
551551response_code = result .status_code ,
552552error_message = error_message ,
553553response_body = result .content ,
554554 )
555555
556- raise GitlabHttpError (
556+ raise gitlab . exceptions . GitlabHttpError (
557557response_code = result .status_code ,
558558error_message = error_message ,
559559response_body = result .content ,
@@ -592,7 +592,7 @@ def http_get(self, path, query_data=None, streamed=False, raw=False, **kwargs):
592592try :
593593return result .json ()
594594except Exception as e :
595- raise GitlabParsingError (
595+ raise gitlab . exceptions . GitlabParsingError (
596596error_message = "Failed to parse the server message"
597597 )from e
598598else :
@@ -674,7 +674,7 @@ def http_post(self, path, query_data=None, post_data=None, files=None, **kwargs)
674674if result .headers .get ("Content-Type" ,None )== "application/json" :
675675return result .json ()
676676except Exception as e :
677- raise GitlabParsingError (
677+ raise gitlab . exceptions . GitlabParsingError (
678678error_message = "Failed to parse the server message"
679679 )from e
680680return result
@@ -712,7 +712,7 @@ def http_put(self, path, query_data=None, post_data=None, files=None, **kwargs):
712712try :
713713return result .json ()
714714except Exception as e :
715- raise GitlabParsingError (
715+ raise gitlab . exceptions . GitlabParsingError (
716716error_message = "Failed to parse the server message"
717717 )from e
718718
@@ -732,7 +732,7 @@ def http_delete(self, path, **kwargs):
732732 """
733733return self .http_request ("delete" ,path ,** kwargs )
734734
735- @on_http_error (GitlabSearchError )
735+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabSearchError )
736736def 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):
792792try :
793793self ._data = result .json ()
794794except Exception as e :
795- raise GitlabParsingError (
795+ raise gitlab . exceptions . GitlabParsingError (
796796error_message = "Failed to parse the server message"
797797 )from e
798798