IDEMSInternational / rapidpro-flow-toolkit

Toolkit for using spreadsheets to create and modify RapidPro flows
GNU Lesser General Public License v2.1
3 stars 1 forks source link

FlowParser: Add support for webhooks #100

Closed geoo89 closed 8 months ago

geoo89 commented 9 months ago

Adds a new call_webhook row type. This row type takes the following unique arguments:

This is done by defining a new Webhook ParserModel and adding a webhook attribute to the FlowRowModel. This attribute is an instance of the Webhook model.

See TestWebhook in tests/test_flowparser.py for examples.

Fixes #98

geoo89 commented 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 of type(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).

istride commented 8 months ago

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.

istride commented 8 months ago

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.

geoo89 commented 8 months ago

LGTM.