Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: remove usage of 'from ... import *' in client.py#1318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nejch merged 1 commit intopython-gitlab:masterfromJohnVillalovos:jlvillal/testing
Feb 22, 2021
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletionsgitlab/client.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,9 +22,9 @@
import requests.utils

import gitlab.config
from gitlab.const import * # noqa
from gitlab.exceptions import * # noqa
from gitlab import utils # noqa
import gitlab.const
import gitlab.exceptions
from gitlab import utils
from requests_toolbelt.multipart.encoder import MultipartEncoder


Expand DownExpand Up@@ -69,7 +69,7 @@ def __init__(
per_page=None,
pagination=None,
order_by=None,
user_agent=USER_AGENT,
user_agent=gitlab.const.USER_AGENT,
):

self._api_version = str(api_version)
Expand DownExpand Up@@ -239,7 +239,7 @@ def version(self):

return self._server_version, self._server_revision

@on_http_error(GitlabVerifyError)
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabVerifyError)
def lint(self, content, **kwargs):
"""Validate a gitlab CI configuration.

Expand All@@ -259,7 +259,7 @@ def lint(self, content, **kwargs):
data = self.http_post("/ci/lint", post_data=post_data, **kwargs)
return (data["status"] == "valid", data["errors"])

@on_http_error(GitlabMarkdownError)
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabMarkdownError)
def markdown(self, text, gfm=False, project=None, **kwargs):
"""Render an arbitrary Markdown document.

Expand All@@ -284,7 +284,7 @@ def markdown(self, text, gfm=False, project=None, **kwargs):
data = self.http_post("/markdown", post_data=post_data, **kwargs)
return data["html"]

@on_http_error(GitlabLicenseError)
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
def get_license(self, **kwargs):
"""Retrieve information about the current license.

Expand All@@ -300,7 +300,7 @@ def get_license(self, **kwargs):
"""
return self.http_get("/license", **kwargs)

@on_http_error(GitlabLicenseError)
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabLicenseError)
def set_license(self, license, **kwargs):
"""Add a new license.

Expand DownExpand Up@@ -438,7 +438,7 @@ def _check_redirects(self, result):
# Did we end-up with an https:// URL?
location = item.headers.get("Location", None)
if location and location.startswith("https://"):
raise RedirectError(REDIRECT_MSG)
raisegitlab.exceptions.RedirectError(REDIRECT_MSG)

def http_request(
self,
Expand DownExpand Up@@ -559,13 +559,13 @@ def http_request(
pass

if result.status_code == 401:
raise GitlabAuthenticationError(
raisegitlab.exceptions.GitlabAuthenticationError(
response_code=result.status_code,
error_message=error_message,
response_body=result.content,
)

raise GitlabHttpError(
raisegitlab.exceptions.GitlabHttpError(
response_code=result.status_code,
error_message=error_message,
response_body=result.content,
Expand DownExpand Up@@ -604,7 +604,7 @@ def http_get(self, path, query_data=None, streamed=False, raw=False, **kwargs):
try:
return result.json()
except Exception as e:
raise GitlabParsingError(
raisegitlab.exceptions.GitlabParsingError(
error_message="Failed to parse the server message"
) from e
else:
Expand DownExpand Up@@ -686,7 +686,7 @@ def http_post(self, path, query_data=None, post_data=None, files=None, **kwargs)
if result.headers.get("Content-Type", None) == "application/json":
return result.json()
except Exception as e:
raise GitlabParsingError(
raisegitlab.exceptions.GitlabParsingError(
error_message="Failed to parse the server message"
) from e
return result
Expand DownExpand Up@@ -724,7 +724,7 @@ def http_put(self, path, query_data=None, post_data=None, files=None, **kwargs):
try:
return result.json()
except Exception as e:
raise GitlabParsingError(
raisegitlab.exceptions.GitlabParsingError(
error_message="Failed to parse the server message"
) from e

Expand All@@ -744,7 +744,7 @@ def http_delete(self, path, **kwargs):
"""
return self.http_request("delete", path, **kwargs)

@on_http_error(GitlabSearchError)
@gitlab.exceptions.on_http_error(gitlab.exceptions.GitlabSearchError)
def search(self, scope, search, **kwargs):
"""Search GitLab resources matching the provided string.'

Expand DownExpand Up@@ -804,7 +804,7 @@ def _query(self, url, query_data=None, **kwargs):
try:
self._data = result.json()
except Exception as e:
raise GitlabParsingError(
raisegitlab.exceptions.GitlabParsingError(
error_message="Failed to parse the server message"
) from e

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp