You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-8Lines changed: 18 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -243,6 +243,8 @@ It provides the following methods:
243
243
-`set_device_parameters(secret_key, data_format, last_request_count, last_request_timestamp)`: Used to set the device data required for proper processing of the request in the handler if it was not set initially, which is often the case as the serial number is usually required to fetch that data. It will return `ValueError` if either of the parameters is invalid.
244
244
-`is_auth_valid()`: Returns `true` if the authentication provided is valid or `false` if not. Note that it checks both that the signature is valid and that the `request_count` or `timestamp` are more recent than the one provided in the device parameters.
245
245
-`get_simple_metrics()`: Returns the metrics provided in the simple expanded format. It will also convert relative timestamps into explicit timestamps for easier processing.
246
+
-`get_data_timestamp()`: Returns the timestamp of the data, either the `data_collection_timestamp` if available or the timestamp `timestamp` or the time of the request as fallback.
247
+
-`get_token_count()`: Returns the token count provided in the request (if any).
246
248
-`expects_token_answer()`: Return `true` if the payload requested tokens in the answer. You can set the tokens to be returned by calling `add_tokens_to_answer(token_list)` with `token_list` being a list of token strings.
247
249
-`expects_time_answer()`: Return `true` if the payload requested either relative time or absolute time in the answer. You can set the time to be returned by calling `add_time_to_answer(target_datetime)` with `target_datetime` being a datetime object. The function will automatically provide it in the correct format based on the request.
248
250
-`add_settings_to_answer(settings_dict)`: Will add the provided settings dictionnary to the answer.
@@ -255,7 +257,7 @@ It provides the following methods:
255
257
256
258
```python
257
259
from openpaygo import MetricsResponseHandler
258
-
from my_db_service import get_device, get_data_format, store_metric
260
+
from my_db_service import get_device, get_data_format, store_metric, get_pending_tokens
259
261
260
262
261
263
@app.route('/dd')
@@ -272,23 +274,26 @@ def device_data():
272
274
# We set the device parameters in the metrics handler
0 commit comments