Commit Graph

65 Commits

Author SHA1 Message Date
Fabio Manganiello 36fdcf6963 - The context should be properly expanded also when calling a Python procedure
- Refactored the logic for executing a request and wrapping the response common to procedures, crons and event hook decorators into platypush.common.exec_wrapper

- Added mock getvalue() method to Logger to prevent PyCharm failures in the tests when sys.stdout is redirected to the Logger object
2021-02-27 20:27:36 +01:00
Fabio Manganiello b4f9472fc5 - Proper expansion of the context variables on functional procedure call
- Expanded and refactored tests framework

- Added test_procedure
2021-02-27 15:01:25 +01:00
Fabio Manganiello 9e00428568 Don't fail silently if there were errors in parsing ${} variables or getting the context 2021-02-26 22:43:54 +01:00
Fabio Manganiello b4258faa29 Fixed broken regular expressions after LINT refactor 2021-02-26 22:33:26 +01:00
Fabio Manganiello d0a579cf4b Fixed old regex sequences to r'' format 2021-02-24 01:28:46 +01:00
Fabio Manganiello 3cf91a3f27 Fixed backend.zigbee.mqtt to work with the new zigbee2mqtt API 2021-02-11 23:50:28 +01:00
Fabio Manganiello 8a7f783032 Support for list args type in requests 2020-10-28 23:18:55 +01:00
Fabio Manganiello c269c62fe6 Refactored logging names 2020-09-27 01:33:38 +02:00
Fabio Manganiello 0dae03551f Implemented interface for custom Python scripts, procedures and hooks [closes #131] 2020-04-08 23:22:54 +02:00
Fabio Manganiello 40e65d882f Support for while/break/continue/return statemnts - closes #107 2020-01-09 10:28:02 +01:00
Fabio Manganiello d8a7c9c6e0 Added Arduino over Firmata integration - closes #92 2020-01-05 00:46:46 +01:00
Fabio Manganiello be5c5d365c Added execute tab to webpanel 2019-12-08 16:25:03 +01:00
Fabio Manganiello 92533c8303 Added special utils.get_context action to get current context 2019-12-01 17:43:10 +01:00
Fabio Manganiello 24d3810e44 Added NFC backend 2019-07-09 01:44:31 +02:00
Fabio Manganiello 0596d77403 Support for camera snapshot and stream endpoints and for disabling logging on response and event messages 2019-03-06 02:01:17 +01:00
Fabio Manganiello 0e794cd1b0 Refactored HTTP server to split the routes on separate files and keep the main Flask app object in a separate file as well so it can be easily wrapped by a WSGI instance 2019-02-23 21:19:00 +01:00
Fabio Manganiello 5cbd0fdfe7 Added support for VTT subtitles and subtitles toggling both in local and browser media players 2019-02-12 01:30:55 +01:00
Fabio Manganiello 339d1eb132 Better way to log the impacted plugin and action in case of uncaught exceptions in requests 2019-01-27 17:51:07 +01:00
Fabio Manganiello db4e68e247 Do exception logging at Request level and discard duplicate exception messages between retries 2019-01-13 20:09:25 +01:00
Fabio Manganiello 8ea0519954 Support for set/clear timeout/interval utils actions and error handling refactor
- Added set/cler timeout/interval actions in the utils plugin to
dynamically set or stop timed actions from your custom logic

- Actions error handling refactoring. If a Response is processed with
some errors, then just log the error and return it to the caller,
without raising an exception. If instead the action execution raised an
uncaught exception, then handle the retries properly and return errors
as a list with the output from all the retries, without being too
verbose with the returning and logging the whole stack trace multiple
times.
2019-01-13 19:29:08 +01:00
Fabio Manganiello 2a52eb770b Renamed value variable in expand_value_from_context to _value to prevent common name clashes with attributes named 'value' in the context 2019-01-12 22:43:01 +01:00
Fabio Manganiello 7aefe4e520 More resilient logic in case actions in a procedure return null responses 2019-01-07 00:07:45 +01:00
Fabio Manganiello 8fe4d77e3d Made requests parsing more robust against messages with target not set (e.g. messages received over HTTP API) 2018-12-18 14:59:10 +01:00
Fabio Manganiello 791c36f5df More tolerance on json.loads() in case the parsed value from the request context is not a string 2018-12-03 23:04:23 +01:00
Fabio Manganiello 4a148971b4 Allow non-string values to be passed through a request context as well 2018-12-03 22:52:25 +01:00
Fabio Manganiello 68aaf9cd61 Message timestamp refactored 2018-10-08 13:30:00 +00:00
Fabio Manganiello 948f3dc37d Implemented timestamp mark on messages to trigger message expiration logic in case something stays on the bus for longer than a minute 2018-10-08 10:35:59 +00:00
Fabio Manganiello 13c1895295 Support for runtime arguments on procedures 2018-09-25 19:20:34 +02:00
Fabio Manganiello 6449504e26 Switched the bus to a Redis bus 2018-09-20 10:49:57 +00:00
Fabio Manganiello 822e0a1e25 Better fix for broken async variables and attributes after Python 3.7 migration 2018-08-07 22:00:11 +00:00
Fabio Manganiello ee5e4dff92 Revert "In Python 3.7 async is a strict language keyword that can't be used for variables names - replaces occurrences with _async"
This reverts commit f0577733b6.
2018-08-07 21:52:07 +00:00
Fabio Manganiello b023618950 Revert "In Python 3.7 async is a strict language keyword that can't be used for variables names - replaces occurrences with _async"
This reverts commit e625861edf.
2018-08-07 21:52:02 +00:00
Fabio Manganiello f0577733b6 In Python 3.7 async is a strict language keyword that can't be used for variables names - replaces occurrences with _async 2018-08-07 21:28:06 +00:00
Fabio Manganiello e625861edf In Python 3.7 async is a strict language keyword that can't be used for variables names - replaces occurrences with _async 2018-08-07 21:26:57 +00:00
Fabio Manganiello 66d78c8615 [#61] Plugins actions refactoring
- Using `@action` annotation to indicate methods that are allowed to be
executed as actions

- The output and errors of an action are automatically wrapped into a
`Response` object without any response build required on the plugin side
2018-07-06 02:08:38 +02:00
Fabio Manganiello 81a81312e3 Basic support for token authentication on request level 2018-07-05 09:15:53 +02:00
Fabio Manganiello 061b676fbc If the string assignment didn't work either, give up without failing (also in Request) 2018-06-14 19:12:16 +02:00
Fabio Manganiello f67b737a54 Best effort in context expansion 2018-06-07 09:33:26 +02:00
Fabio Manganiello 4da74b1096 Refactored logging submodule 2018-06-06 20:09:23 +02:00
Fabio Manganiello c867a21104 If the value is a platypush Message, then converting it into a string would result in a JSON dumps that might break the interpreter (e.g. 'null' is a valid JSON keyword but it's not recognized by Python). Therefore first parse the variable from JSON 2018-06-06 18:50:09 +02:00
Fabio Manganiello 850a4f2146 A less convoluted and robust way to expand the context as variables 2018-06-06 17:14:44 +02:00
Fabio Manganiello 9923742e74 Prevent plugins from breaking in case of concatenations with None elements 2018-05-14 19:06:11 +02:00
Fabio Manganiello 6ef97e9ddc Assign the recursive output of _thread_func to response to make sure that the latest response is always returned - that means the successful response in case the previous one was a failure 2018-04-22 21:26:53 +02:00
Fabio Manganiello 834b700d5f Added GMail actions support, solves #49 2018-01-17 03:16:59 +01:00
Fabio Manganiello 14b511034f Support for cron actions, solves #47 2018-01-15 22:37:01 +01:00
Fabio Manganiello 959296b15a Support for context variables and constants 2018-01-10 18:47:25 +01:00
Fabio Manganiello d4ef2bf59e Implemented for loops support in procedures, #44 2018-01-08 02:41:24 +01:00
Fabio Manganiello 252f503e4d Better management of the context and support for proper expression expansion from the context in the action execution through eval 2018-01-07 23:31:19 +01:00
Fabio Manganiello dfee3f5004 Recursively expand the context of a request over the nested arguments 2018-01-06 12:40:22 +01:00
Fabio Manganiello f83aedf0f1 Support for synchronous and asynchronous procedures 2018-01-06 00:21:25 +01:00