-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAbstractRequester.py
More file actions
30 lines (21 loc) · 990 Bytes
/
AbstractRequester.py
File metadata and controls
30 lines (21 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import abc
from requests import Response, Session
class AbstractRequester(Session, metaclass=abc.ABCMeta):
def __init__(self, first_part_url: str = ''):
super().__init__()
self.first_part_url = first_part_url
@abc.abstractmethod
def get(self, url: str = '', **kwargs) -> Response:
return super().get(url=self.first_part_url + url, **kwargs)
@abc.abstractmethod
def post(self, url: str = '', **kwargs) -> Response:
return super().post(url=self.first_part_url + url, **kwargs)
@abc.abstractmethod
def put(self, url: str = '', **kwargs) -> Response:
return super().put(url=self.first_part_url + url, **kwargs)
@abc.abstractmethod
def patch(self, url: str = '', **kwargs) -> Response:
return super().patch(url=self.first_part_url + url, **kwargs)
@abc.abstractmethod
def delete(self, url: str = '', **kwargs) -> Response:
return super().delete(url=self.first_part_url + url, **kwargs)