Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add passive Flask-based sensor that echoes input #3667

Merged
merged 7 commits into from
Aug 16, 2017

Conversation

warrenvw
Copy link
Contributor

@warrenvw warrenvw commented Aug 11, 2017

See #3663

A simple, Flask-based sensor that relays the incoming payload to the trigger.

To Do:

  • Testing

@warrenvw warrenvw changed the title WIP - Add passive Flask-based sensor that echo's input WIP - Add passive Flask-based sensor that echoes input Aug 14, 2017
@warrenvw warrenvw changed the title WIP - Add passive Flask-based sensor that echoes input Add passive Flask-based sensor that echoes input Aug 15, 2017
@warrenvw warrenvw added the RFR label Aug 15, 2017

self._log.info('Listening for payload on http://%s:%s%s' %
(self._host, self._port, self._path))
self._app.run(host=self._host, port=self._port)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use threaded=True for Flask app, otherwise it will block on 1+ requests,
see similar: StackStorm-Exchange/stackstorm-activecampaign#3

If threading is not enabled, then it will block when there's more than
one request.

See similar: StackStorm-Exchange/stackstorm-activecampaign#3
@warrenvw warrenvw merged commit 4ea5704 into master Aug 16, 2017
@warrenvw warrenvw deleted the wvw/echo-flask-sensor branch August 16, 2017 18:55
@warrenvw warrenvw removed the RFR label Aug 21, 2017
@LindsayHill
Copy link
Contributor

@warrenvw looks like the trigger name dispatched in the .py file doesn't match the trigger definition in the YAML?

@NikosVlagoidis
Copy link
Contributor

So I guess Flask is already installed. How can I install my requirements for a sensor? Should I make a pack?

@LindsayHill
Copy link
Contributor

@NikosVlagoidis Regardless of requirements, yes, your sensor will need to be in a pack, usually your own. That pack should have a requirements.txt file. When you install the pack, ST2 will create a virtualenv for that pack, and install the requirements

@NikosVlagoidis
Copy link
Contributor

thank you, sir.

@NikosVlagoidis
Copy link
Contributor

Tried to use that inside a Docker container. Flask complains. Port must be an integer. Can someone confirm that?

@LindsayHill
Copy link
Contributor

LindsayHill commented Dec 17, 2017 via email

@NikosVlagoidis
Copy link
Contributor

Yes changing to integer worked.

@LindsayHill
Copy link
Contributor

Good to hear. Would you mind submitting a PR with a fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants