2222import requests .utils
2323
2424import gitlab .config
25- from gitlab .const import * # noqa
26- from gitlab .exceptions import * # noqa
27- from gitlab import utils # noqa
25+ import gitlab .const
26+ import gitlab .exceptions
27+ from gitlab import utils
2828from requests_toolbelt .multipart .encoder import MultipartEncoder
2929
3030
@@ -69,7 +69,7 @@ def __init__(
6969per_page = None ,
7070pagination = None ,
7171order_by = None ,
72- user_agent = USER_AGENT ,
72+ user_agent = gitlab . const . USER_AGENT ,
7373 ):
7474
7575self ._api_version = str (api_version )
@@ -239,7 +239,7 @@ def version(self):
239239
240240return self ._server_version ,self ._server_revision
241241
242- @on_http_error (GitlabVerifyError )
242+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabVerifyError )
243243def lint (self ,content ,** kwargs ):
244244"""Validate a gitlab CI configuration.
245245
@@ -259,7 +259,7 @@ def lint(self, content, **kwargs):
259259data = self .http_post ("/ci/lint" ,post_data = post_data ,** kwargs )
260260return (data ["status" ]== "valid" ,data ["errors" ])
261261
262- @on_http_error (GitlabMarkdownError )
262+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabMarkdownError )
263263def markdown (self ,text ,gfm = False ,project = None ,** kwargs ):
264264"""Render an arbitrary Markdown document.
265265
@@ -284,7 +284,7 @@ def markdown(self, text, gfm=False, project=None, **kwargs):
284284data = self .http_post ("/markdown" ,post_data = post_data ,** kwargs )
285285return data ["html" ]
286286
287- @on_http_error (GitlabLicenseError )
287+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabLicenseError )
288288def get_license (self ,** kwargs ):
289289"""Retrieve information about the current license.
290290
@@ -300,7 +300,7 @@ def get_license(self, **kwargs):
300300 """
301301return self .http_get ("/license" ,** kwargs )
302302
303- @on_http_error (GitlabLicenseError )
303+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabLicenseError )
304304def set_license (self ,license ,** kwargs ):
305305"""Add a new license.
306306
@@ -438,7 +438,7 @@ def _check_redirects(self, result):
438438# Did we end-up with an https:// URL?
439439location = item .headers .get ("Location" ,None )
440440if location and location .startswith ("https://" ):
441- raise RedirectError (REDIRECT_MSG )
441+ raise gitlab . exceptions . RedirectError (REDIRECT_MSG )
442442
443443def http_request (
444444self ,
@@ -559,13 +559,13 @@ def http_request(
559559pass
560560
561561if result .status_code == 401 :
562- raise GitlabAuthenticationError (
562+ raise gitlab . exceptions . GitlabAuthenticationError (
563563response_code = result .status_code ,
564564error_message = error_message ,
565565response_body = result .content ,
566566 )
567567
568- raise GitlabHttpError (
568+ raise gitlab . exceptions . GitlabHttpError (
569569response_code = result .status_code ,
570570error_message = error_message ,
571571response_body = result .content ,
@@ -604,7 +604,7 @@ def http_get(self, path, query_data=None, streamed=False, raw=False, **kwargs):
604604try :
605605return result .json ()
606606except Exception as e :
607- raise GitlabParsingError (
607+ raise gitlab . exceptions . GitlabParsingError (
608608error_message = "Failed to parse the server message"
609609 )from e
610610else :
@@ -686,7 +686,7 @@ def http_post(self, path, query_data=None, post_data=None, files=None, **kwargs)
686686if result .headers .get ("Content-Type" ,None )== "application/json" :
687687return result .json ()
688688except Exception as e :
689- raise GitlabParsingError (
689+ raise gitlab . exceptions . GitlabParsingError (
690690error_message = "Failed to parse the server message"
691691 )from e
692692return result
@@ -724,7 +724,7 @@ def http_put(self, path, query_data=None, post_data=None, files=None, **kwargs):
724724try :
725725return result .json ()
726726except Exception as e :
727- raise GitlabParsingError (
727+ raise gitlab . exceptions . GitlabParsingError (
728728error_message = "Failed to parse the server message"
729729 )from e
730730
@@ -744,7 +744,7 @@ def http_delete(self, path, **kwargs):
744744 """
745745return self .http_request ("delete" ,path ,** kwargs )
746746
747- @on_http_error (GitlabSearchError )
747+ @gitlab . exceptions . on_http_error (gitlab . exceptions . GitlabSearchError )
748748def search (self ,scope ,search ,** kwargs ):
749749"""Search GitLab resources matching the provided string.'
750750
@@ -804,7 +804,7 @@ def _query(self, url, query_data=None, **kwargs):
804804try :
805805self ._data = result .json ()
806806except Exception as e :
807- raise GitlabParsingError (
807+ raise gitlab . exceptions . GitlabParsingError (
808808error_message = "Failed to parse the server message"
809809 )from e
810810