|
| 1 | +# SPDX-FileCopyrightText: Copyright (c) 2022 Alec Delaney |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: MIT |
| 4 | + |
| 5 | +""" |
| 6 | +`circuitpython_typing.http` |
| 7 | +=========================== |
| 8 | +
|
| 9 | +Type annotation definitions for HTTP and related objects |
| 10 | +
|
| 11 | +* Author(s): Alec Delaney |
| 12 | +""" |
| 13 | + |
| 14 | +# Protocol was introduced in Python 3.8. |
| 15 | +from typing_extensions import Protocol |
| 16 | +from adafruit_requests import Response |
| 17 | + |
| 18 | + |
| 19 | +class HTTPProtocol(Protocol): |
| 20 | + """Protocol for HTTP request managers, like typical wifi managers""" |
| 21 | + |
| 22 | + def get(self, url: str, **kw) -> Response: |
| 23 | + """Send HTTP GET request""" |
| 24 | + ... |
| 25 | + |
| 26 | + def put(self, url: str, **kw) -> Response: |
| 27 | + """Send HTTP PUT request""" |
| 28 | + ... |
| 29 | + |
| 30 | + def post(self, url: str, **kw) -> Response: |
| 31 | + """Send HTTP POST request""" |
| 32 | + ... |
| 33 | + |
| 34 | + def patch(self, url: str, **kw) -> Response: |
| 35 | + """Send HTTP PATCH request""" |
| 36 | + ... |
| 37 | + |
| 38 | + def delete(self, url: str, **kw) -> Response: |
| 39 | + """Send HTTP DELETE request""" |
| 40 | + ... |
0 commit comments