Title: Apache Listener? Execute Python Script
Tags: python;apache
Question: Question: I am a nascent developer and I am self taught for the most part. I use what Python and BASH skills I have at work regularly, but I mostly just parse json arrays and POST them to URLs other than their origin. Preamble aside...
I setup a LAMP server (python3) and need it to fire off a python script I dev'd when a specific URL is accessed. Having said that, I have no idea how to do this in python, and after a LOT of googling I'm coming to the conclusion that maybe I'm trying to create a "Listener", a subject of I have no experience with.
TL;DR - I need to trigger a python script when an Apache-based URL receives a POST request. I have no idea how to do so. Please help.
Comment: This is typically done using a controller (The C in MVC). The controller is mapped to a URL, and some code is executed (your script) when that URL is hit, with some result returned to the caller. You may not need the MV (Model, View), but that should point you in the right direction.

Comment: did you try something already?

Comment: I've tried the polling method based on time, but of course there is a delay related to how often I run the cron job. It works, but this is SMS, an immediate action is preferable and is what I'm after :) I can tell Twilio to POST to a URL, if I could get that POST action to trigger a script that would be preferable.

Comment: Thank you for the lead, I'll do some research.



{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 0, 'CommentCount': 4, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2017:00:03/06/17', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<python><apache>', 'Title': 'Apache Listener? Execute Python Script', 'ViewCount': 72, 'id': 42635052, 'user_AboutMe': '<p>Artist turned techie (juxtaposed the two median salaries).</p>\n<p>I love everything comic book, Star Wars, and Linux. Huzzah!!!</p>\n', 'user_AccountId': 7116185.0, 'user_DisplayName': 'izzy.artistic', 'user_Reputation': 1.0, 'user_Views': 2.0, 'user_id': 7164730.0}}