aboutsummaryrefslogtreecommitdiffstats
path: root/pygithub3/services
diff options
context:
space:
mode:
Diffstat (limited to 'pygithub3/services')
-rw-r--r--pygithub3/services/base.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/pygithub3/services/base.py b/pygithub3/services/base.py
index 98969c6..f124e42 100644
--- a/pygithub3/services/base.py
+++ b/pygithub3/services/base.py
@@ -4,6 +4,7 @@
from pygithub3.core.client import Client
from pygithub3.core.result import Result
from pygithub3.core.ghrequests import Factory
+from pygithub3.core.errors import NotFound
class Base(object):
@@ -24,19 +25,38 @@ class Base(object):
def set_repo(self, repo):
self.client.repo = repo
- def config_request(self, **kwargs):
+ def _config_request(self, **kwargs):
self.get_request.config_with(**kwargs)
+ def _bool(self, request_uri, **kwargs):
+ request = self.get_request(request_uri)
+ try:
+ self.client.head(request, **kwargs)
+ return True
+ except NotFound:
+ return False
+
+ def _patch(self, request_uri, **kwargs):
+ request = self.get_request(request_uri)
+ resource = request.get_resource()
+ input_data = request.get_data()
+ response = self.client.patch(request, data=input_data, **kwargs)
+ return resource.loads(response.content)
+
+ def _put(self, request_uri, **kwargs):
+ request = self.get_request(request_uri)
+ self.client.put(request, **kwargs)
+
def _delete(self, request_uri, **kwargs):
request = self.get_request(request_uri)
input_data = request.get_data()
- self.client.delete(request, data=input_data)
+ self.client.delete(request, data=input_data, **kwargs)
def _post(self, request_uri, **kwargs):
request = self.get_request(request_uri)
resource = request.get_resource()
input_data = request.get_data()
- response = self.client.post(request, data=input_data)
+ response = self.client.post(request, data=input_data, **kwargs)
return resource.loads(response.content)
def _get(self, request_uri, **kwargs):