Closed geoo89 closed 8 months ago
There are some errors which are straightforward to fix. Please use flake8 to reveal them. They will be things like:
- use
type(x) is list
instead oftype(x) == list
- don't use f-strings without placeholders
And others. I plan to integrate black, flake8 and isort into the development process in future, so it would be good to be familiar with these tools, if you are not already.
I used black to format the code and it didn't have any complaints. I didn't run flake8. What is the reason for using both, is there no autoformatter for flake8?
I now addressed the flake8 issues in those lines that this PR touches (except the line length issues in tests/test_flowparser.py
, as I don't see a way of reducing line length without hampering readability).
There is some overlap between black and flake8, in that flake8 will warn about code style issues, but it also warns more generally about other issues with the code. black will automatically fix issues related to code style, but flake8 only notifies. It is worth configuring your IDE or editor to show the issues that flake8 identifies.
I have corrected a few more issues identified by flake8 and some redundant code, but only in the files that have been modified in this PR. You might want to quickly check my changes.
LGTM.
Adds a new
call_webhook
row type. This row type takes the following unique arguments:webhook.url
: URL of the webhook (string)webhook.method
: HTTP method (string). Default is POSTwebhook.headers
: HTTP Headers (list of pairs). For example:"Accept;application/json|Content-Type;application/json"
"Authorization;Token 12345|"
(trailing|
to indicate list of lists)webhook.body
/message_text
(alias): Body of the webhooksave_name
: Variable name the result is saved as.This is done by defining a new
Webhook
ParserModel
and adding awebhook
attribute to theFlowRowModel
. This attribute is an instance of theWebhook
model.See
TestWebhook
intests/test_flowparser.py
for examples.Fixes #98