pyceo/ceo_common/interfaces/IHTTPClient.py

24 lines
621 B
Python
Raw Permalink 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-28 23:09:02 -04:00
def request(host: str, path: str, method: str, **kwargs):
2021-08-25 22:19:18 -04:00
"""
Make an HTTP request.
2021-08-28 23:09:02 -04:00
**kwargs are passed to requests.request().
2021-08-25 22:19:18 -04:00
"""
2021-08-23 09:59:01 -04:00
2021-08-28 23:09:02 -04:00
def get(host: str, path: str, **kwargs):
2021-07-24 17:09:10 -04:00
"""Make a GET request."""
2021-08-28 23:09:02 -04:00
def post(host: str, path: str, **kwargs):
2021-07-24 17:09:10 -04:00
"""Make a POST request."""
2021-08-28 23:09:02 -04:00
def patch(host: str, path: str, **kwargs):
2021-08-23 09:59:01 -04:00
"""Make a PATCH request."""
2021-08-28 23:09:02 -04:00
def delete(host: str, path: str, **kwargs):
2021-07-24 17:09:10 -04:00
"""Make a DELETE request."""