gogs-client
Advanced tools
| Metadata-Version: 1.1 | ||
| Name: gogs-client | ||
| Version: 1.0.5 | ||
| Version: 1.0.6 | ||
| Summary: A python library for interacting with a gogs server | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/unfoldingWord-dev/python-gogs-client |
+99
-42
@@ -44,4 +44,4 @@ import requests | ||
| """ | ||
| response = self._get("/user", auth=auth) | ||
| return GogsUser.from_json(self._check_ok(response).json()) | ||
| response = self.get("/user", auth=auth) | ||
| return GogsUser.from_json(response.json()) | ||
@@ -65,4 +65,4 @@ def get_tokens(self, auth, username=None): | ||
| username = self.authenticated_user(auth).username | ||
| response = self._get("/users/{u}/tokens".format(u=username), auth=auth) | ||
| return [Token.from_json(o) for o in self._check_ok(response).json()] | ||
| response = self.get("/users/{u}/tokens".format(u=username), auth=auth) | ||
| return [Token.from_json(o) for o in response.json()] | ||
@@ -88,4 +88,4 @@ def create_token(self, auth, name, username=None): | ||
| data = {"name": name} | ||
| response = self._post("/users/{u}/tokens".format(u=username), auth=auth, data=data) | ||
| return Token.from_json(self._check_ok(response).json()) | ||
| response = self.post("/users/{u}/tokens".format(u=username), auth=auth, data=data) | ||
| return Token.from_json(response.json()) | ||
@@ -149,4 +149,4 @@ def ensure_token(self, auth, name, username=None): | ||
| url = "/org/{0}/repos".format(organization) if organization else "/user/repos" | ||
| response = self._post(url, auth=auth, data=data) | ||
| return GogsRepo.from_json(self._check_ok(response).json()) | ||
| response = self.post(url, auth=auth, data=data) | ||
| return GogsRepo.from_json(response.json()) | ||
@@ -182,3 +182,3 @@ def repo_exists(self, auth, username, repo_name): | ||
| path = "/repos/{u}/{r}".format(u=username, r=repo_name) | ||
| response = self._check_ok(self._get(path, auth=auth)) | ||
| response = self.get(path, auth=auth) | ||
| return GogsRepo.from_json(response.json()) | ||
@@ -199,3 +199,3 @@ | ||
| path = "/users/{u}/repos".format(u=username) | ||
| response = self._check_ok(self._get(path, auth=auth)) | ||
| response = self.get(path, auth=auth) | ||
| return [GogsRepo.from_json(repo_json) for repo_json in response.json()] | ||
@@ -218,3 +218,3 @@ | ||
| path = "/repos/{u}/{r}/branches/{b}".format(u=username, r=repo_name, b=branch_name) | ||
| response = self._check_ok(self._get(path, auth=auth)) | ||
| response = self.get(path, auth=auth) | ||
| return GogsBranch.from_json(response.json()) | ||
@@ -236,3 +236,3 @@ | ||
| path = "/repos/{u}/{r}/branches".format(u=username, r=repo_name) | ||
| response = self._check_ok(self._get(path, auth=auth)) | ||
| response = self.get(path, auth=auth) | ||
| return [GogsBranch.from_json(branch_json) for branch_json in response.json()] | ||
@@ -251,3 +251,3 @@ | ||
| path = "/repos/{u}/{r}".format(u=username, r=repo_name) | ||
| self._check_ok(self._delete(path, auth=auth)) | ||
| self.delete(path, auth=auth) | ||
@@ -285,4 +285,4 @@ def migrate_repo(self, auth, clone_addr, | ||
| url = "/repos/migrate" | ||
| response = self._post(url, auth=auth, data=data) | ||
| return GogsRepo.from_json(self._check_ok(response).json()) | ||
| response = self.post(url, auth=auth, data=data) | ||
| return GogsRepo.from_json(response.json()) | ||
@@ -313,4 +313,3 @@ def create_user(self, auth, login_name, username, email, password, send_notify=False): | ||
| } | ||
| response = self._post("/admin/users", auth=auth, data=data) | ||
| self._check_ok(response) | ||
| response = self.post("/admin/users", auth=auth, data=data) | ||
| return GogsUser.from_json(response.json()) | ||
@@ -344,3 +343,3 @@ | ||
| params = {"q": username_keyword, "limit": limit} | ||
| response = self._check_ok(self._get("/users/search", params=params)) | ||
| response = self.get("/users/search", params=params) | ||
| return [GogsUser.from_json(user_json) for user_json in response.json()["data"]] | ||
@@ -360,3 +359,3 @@ | ||
| path = "/users/{}".format(username) | ||
| response = self._check_ok(self._get(path, auth=auth)) | ||
| response = self.get(path, auth=auth) | ||
| return GogsUser.from_json(response.json()) | ||
@@ -377,3 +376,3 @@ | ||
| path = "/admin/users/{}".format(username) | ||
| response = self._check_ok(self._patch(path, auth=auth, data=update.as_dict())) | ||
| response = self.patch(path, auth=auth, data=update.as_dict()) | ||
| return GogsUser.from_json(response.json()) | ||
@@ -390,3 +389,3 @@ | ||
| path = "/admin/users/{}".format(username) | ||
| self._check_ok(self._delete(path, auth=auth)) | ||
| self.delete(path, auth=auth) | ||
@@ -407,3 +406,3 @@ def get_repo_hooks(self, auth, username, repo_name): | ||
| path = "/repos/{u}/{r}/hooks".format(u=username, r=repo_name) | ||
| response = self._check_ok(self._get(path, auth=auth)) | ||
| response = self.get(path, auth=auth) | ||
| return [GogsRepo.Hook.from_json(hook) for hook in response.json()] | ||
@@ -440,4 +439,3 @@ | ||
| else "/repos/{r}/hooks".format(r=repo_name) | ||
| response = self._post(url, auth=auth, data=data) | ||
| self._check_ok(response) | ||
| response = self.post(url, auth=auth, data=data) | ||
| return GogsRepo.Hook.from_json(response.json()) | ||
@@ -463,3 +461,3 @@ | ||
| path = "/repos/{r}/hooks/{i}".format(r=repo_name, i=hook_id) | ||
| response = self._check_ok(self._patch(path, auth=auth, data=update.as_dict())) | ||
| response = self._patch(path, auth=auth, data=update.as_dict()) | ||
| return GogsRepo.Hook.from_json(response.json()) | ||
@@ -480,3 +478,3 @@ | ||
| path = "/repos/{u}/{r}/hooks/{i}".format(u=username, r=repo_name, i=hook_id) | ||
| self._check_ok(self._delete(path, auth=auth)) | ||
| self.delete(path, auth=auth) | ||
@@ -509,4 +507,3 @@ def create_organization(self, auth, owner_name, org_name, full_name=None, description=None, | ||
| url = "/admin/users/{u}/orgs".format(u=owner_name) | ||
| response = self._post(url, auth=auth, data=data) | ||
| self._check_ok(response) | ||
| response = self.post(url, auth=auth, data=data) | ||
| return GogsOrg.from_json(response.json()) | ||
@@ -535,4 +532,3 @@ | ||
| url = "/admin/orgs/{o}/teams".format(o=org_name) | ||
| response = self._post(url, auth=auth, data=data) | ||
| self._check_ok(response) | ||
| response = self.post(url, auth=auth, data=data) | ||
| return GogsTeam.from_json(response.json()) | ||
@@ -551,3 +547,3 @@ | ||
| url = "/admin/teams/{t}/members/{u}".format(t=team_id, u=username) | ||
| self._check_ok(self._put(url, auth=auth)) | ||
| self.put(url, auth=auth) | ||
@@ -565,3 +561,3 @@ def remove_team_membership(self, auth, team_id, username): | ||
| url = "/admin/teams/{t}/members/{u}".format(t=team_id, u=username) | ||
| self._check_ok(self._delete(url, auth=auth)) | ||
| self.delete(url, auth=auth) | ||
@@ -579,3 +575,3 @@ def add_repo_to_team(self, auth, team_id, repo_name): | ||
| url = "/admin/teams/{t}/repos/{r}".format(t=team_id, r=repo_name) | ||
| self._check_ok(self._put(url, auth=auth)) | ||
| self.put(url, auth=auth) | ||
@@ -593,3 +589,3 @@ def remove_repo_from_team(self, auth, team_id, repo_name): | ||
| url = "/admin/teams/{t}/repos/{r}".format(t=team_id, r=repo_name) | ||
| self._check_ok(self._delete(url, auth=auth)) | ||
| self.delete(url, auth=auth) | ||
@@ -608,3 +604,3 @@ def list_deploy_keys(self, auth, username, repo_name): | ||
| """ | ||
| response = self._check_ok(self._get("/repos/{u}/{r}/keys".format(u=username, r=repo_name), auth=auth)) | ||
| response = self.get("/repos/{u}/{r}/keys".format(u=username, r=repo_name), auth=auth) | ||
| return [GogsRepo.DeployKey.from_json(key_json) for key_json in response.json()] | ||
@@ -625,4 +621,3 @@ | ||
| """ | ||
| response = self._check_ok( | ||
| self._get("/repos/{u}/{r}/keys/{k}".format(u=username, r=repo_name, k=key_id), auth=auth)) | ||
| response = self.get("/repos/{u}/{r}/keys/{k}".format(u=username, r=repo_name, k=key_id), auth=auth) | ||
| return GogsRepo.DeployKey.from_json(response.json()) | ||
@@ -648,4 +643,3 @@ | ||
| } | ||
| response = self._check_ok( | ||
| self._post("/repos/{u}/{r}/keys".format(u=username, r=repo_name), auth=auth, data=data)) | ||
| response = self.post("/repos/{u}/{r}/keys".format(u=username, r=repo_name), auth=auth, data=data) | ||
| return GogsRepo.DeployKey.from_json(response.json()) | ||
@@ -664,5 +658,3 @@ | ||
| """ | ||
| response = self._check_ok( | ||
| self._delete("/repos/{u}/{r}/keys/{k}".format(u=username, r=repo_name, k=key_id), auth=auth)) | ||
| self._check_ok(response) | ||
| self.delete("/repos/{u}/{r}/keys/{k}".format(u=username, r=repo_name, k=key_id), auth=auth) | ||
@@ -679,2 +671,15 @@ # Helper methods | ||
| def delete(self, path, auth=None, **kwargs): | ||
| """ | ||
| Manually make a DELETE request. | ||
| :param str path: relative url of the request (e.g. `/users/username`) | ||
| :param auth.Authentication auth: authentication object | ||
| :param kwargs dict: Extra arguments for the request, as supported by | ||
| `requests <http://docs.python-requests.org/>`_ library. | ||
| :raises NetworkFailure: if there is an error communicating with the server | ||
| :raises ApiFailure: if the request cannot be serviced | ||
| """ | ||
| return self._check_ok(self._delete(path, auth=auth, **kwargs)) | ||
| def _get(self, path, auth=None, **kwargs): | ||
@@ -688,2 +693,15 @@ if auth is not None: | ||
| def get(self, path, auth=None, **kwargs): | ||
| """ | ||
| Manually make a GET request. | ||
| :param str path: relative url of the request (e.g. `/users/username`) | ||
| :param auth.Authentication auth: authentication object | ||
| :param kwargs dict: Extra arguments for the request, as supported by | ||
| `requests <http://docs.python-requests.org/>`_ library. | ||
| :raises NetworkFailure: if there is an error communicating with the server | ||
| :raises ApiFailure: if the request cannot be serviced | ||
| """ | ||
| return self._check_ok(self._get(path, auth=auth, **kwargs)) | ||
| def _patch(self, path, auth=None, **kwargs): | ||
@@ -697,2 +715,15 @@ if auth is not None: | ||
| def patch(self, path, auth=None, **kwargs): | ||
| """ | ||
| Manually make a PATCH request. | ||
| :param str path: relative url of the request (e.g. `/users/username`) | ||
| :param auth.Authentication auth: authentication object | ||
| :param kwargs dict: Extra arguments for the request, as supported by | ||
| `requests <http://docs.python-requests.org/>`_ library. | ||
| :raises NetworkFailure: if there is an error communicating with the server | ||
| :raises ApiFailure: if the request cannot be serviced | ||
| """ | ||
| return self._check_ok(self._patch(path, auth=auth, **kwargs)) | ||
| def _post(self, path, auth=None, **kwargs): | ||
@@ -706,2 +737,15 @@ if auth is not None: | ||
| def post(self, path, auth=None, **kwargs): | ||
| """ | ||
| Manually make a POST request. | ||
| :param str path: relative url of the request (e.g. `/users/username`) | ||
| :param auth.Authentication auth: authentication object | ||
| :param kwargs dict: Extra arguments for the request, as supported by | ||
| `requests <http://docs.python-requests.org/>`_ library. | ||
| :raises NetworkFailure: if there is an error communicating with the server | ||
| :raises ApiFailure: if the request cannot be serviced | ||
| """ | ||
| return self._check_ok(self._post(path, auth=auth, **kwargs)) | ||
| def _put(self, path, auth=None, **kwargs): | ||
@@ -715,2 +759,15 @@ if auth is not None: | ||
| def put(self, path, auth=None, **kwargs): | ||
| """ | ||
| Manually make a PUT request. | ||
| :param str path: relative url of the request (e.g. `/users/username`) | ||
| :param auth.Authentication auth: authentication object | ||
| :param kwargs dict: Extra arguments for the request, as supported by | ||
| `requests <http://docs.python-requests.org/>`_ library. | ||
| :raises NetworkFailure: if there is an error communicating with the server | ||
| :raises ApiFailure: if the request cannot be serviced | ||
| """ | ||
| return self._check_ok(self._put(path, auth=auth, **kwargs)) | ||
| @staticmethod | ||
@@ -717,0 +774,0 @@ def _check_ok(response): |
+1
-1
| Metadata-Version: 1.1 | ||
| Name: gogs_client | ||
| Version: 1.0.5 | ||
| Version: 1.0.6 | ||
| Summary: A python library for interacting with a gogs server | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/unfoldingWord-dev/python-gogs-client |
+1
-1
@@ -13,3 +13,3 @@ from codecs import open | ||
| name="gogs_client", | ||
| version="1.0.5", | ||
| version="1.0.6", | ||
| description="A python library for interacting with a gogs server", | ||
@@ -16,0 +16,0 @@ long_description=long_description, |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
100394
2.55%2114
2.27%