API
- class succulent.api.SucculentAPI(config, host='0.0.0.0', port=8080, format='csv')
Bases:
objectSucculent API server.
- Parameters:
host (str) – The host address to run the API server.
port (int) – The port number to run the API server.
config (str) – Path to the configuration file.
format (str, optional) – The format of the data (‘csv’, ‘json’, ‘sqlite’, or ‘image’).
- host
The host address to run the API server.
- Type:
str
- port
The port number to run the API server.
- Type:
int
- config
Configuration file.
- Type:
dict
- format
The format of the data (‘csv’, ‘json’, ‘sqlite’, or ‘image’).
- Type:
str
- app
Flask application.
- Type:
Flask
- processing
Instance of the Processing class.
- Type:
- data()
Display the stored data.
- Returns:
JSON response with the stored data.
- Return type:
Response
- export()
Export the stored data to a CSV file.
- index()
Generate index HTML page with information about the API.
- Returns:
HTML response with the index page.
- Return type:
Response
- measure()
Process the incoming request and store the timestamp.
- Returns:
JSON response with a success message and timestamp.
- Return type:
Response
- start()
Start the Flask application on the specified host and port.
- Returns:
None
- url()
Generate URL with parameters for measurements.
- Returns:
JSON response with the generated URL.
- Return type:
Response