pyceo/ceo_common/interfaces/IHTTPClient.py

25 lines
789 B
Python
Raw Normal View History

2021-07-24 17:09:10 -04:00
from zope.interface import Interface
class IHTTPClient(Interface):
"""A helper class for HTTP requests to ceod."""
2021-08-25 22:19:18 -04:00
def request(host: str, api_path: str, method: str, delegate: bool, **kwargs):
"""
Make an HTTP request.
If `delegate` is True, GSSAPI credentials will be forwarded to the
remote.
"""
2021-08-23 09:59:01 -04:00
2021-08-25 22:19:18 -04:00
def get(host: str, api_path: str, delegate: bool = True, **kwargs):
2021-07-24 17:09:10 -04:00
"""Make a GET request."""
2021-08-25 22:19:18 -04:00
def post(host: str, api_path: str, delegate: bool = True, **kwargs):
2021-07-24 17:09:10 -04:00
"""Make a POST request."""
2021-08-25 22:19:18 -04:00
def patch(host: str, api_path: str, delegate: bool = True, **kwargs):
2021-08-23 09:59:01 -04:00
"""Make a PATCH request."""
2021-08-25 22:19:18 -04:00
def delete(host: str, api_path: str, delegate: bool = True, **kwargs):
2021-07-24 17:09:10 -04:00
"""Make a DELETE request."""