http_device
frog.hardware.http_device
¤
Provides a device which communicates via HTTP requests.
Attributes¤
Classes¤
HTTPDevice(timeout=DEFAULT_HTTP_TIMEOUT)
¤
Bases: AbstractDevice
A device which communicates via HTTP requests.
Create a new HTTPDevice.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
float
|
The maximum time in seconds to wait for a response from the server |
DEFAULT_HTTP_TIMEOUT
|
Source code in frog/hardware/http_device.py
22 23 24 25 26 27 28 29 30 31 32 |
|
Functions¤
handle_response(response)
abstractmethod
¤
The default callback for successful HTTP responses.
Source code in frog/hardware/http_device.py
53 54 55 |
|
make_request(url, callback=None)
¤
Make a new HTTP request in the background.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url
|
str
|
The URL to connect to |
required |
callback
|
Callable[[str], Any] | None
|
A function to be called when a successful response is received |
None
|
Source code in frog/hardware/http_device.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|