Using SimpleHTTPServer to interpret failed requests and dynamically create JSON pages?
<p>I have a python program that takes and validates user input <strong><em>(flightNumber,dateStamp)</em></strong> and performs three api lookups: </p>

<pre><code>1. get flight info, 

2: find flightId, 

3: track flightID and return up to date JSON.
</code></pre>

<p>I should now like to make this information available to the web at  </p>

<pre><code>mysite.com/flightNumber/dateStamp 
</code></pre>

<p>to any user passing a <strong><em>'Valid'</em></strong> flightNumber and dateTime.</p>

<p>Is it possible to:</p>

<p>Setup a SimpleHTTPServer at mysite.com and log all paths attempted.</p>

<p>When a connection is made to any path, it will fail as there's nothing there. (unless/until I cache)</p>

<p>But, I simply send a user a hold message, use 're' Python script to check if the url is <strong><em>'Valid'</em></strong> (flightNumber, dateStamp)</p>

<p>If not <strong><em>'Valid'</em></strong>, I return an error.</p>

<p>If <strong><em>'Valid'</em></strong> I parse the relevant url info into parts of my existing program.</p>

<p>The results I get back from my existing api calls create a JSON readable page at</p>

<pre><code> /flightNumber/dateStamp
</code></pre>

<p>Now I forward the user to the page.</p>

<p>Is this possible? it seems an interesting way to achieve what I'm after</p>

<p>Yes, this all sounds possible, even pretty simple, especially given the lack of detail you have provided.</p>

python json url redirect simplehttpserver