<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
p.MsoHeader, li.MsoHeader, div.MsoHeader
{mso-style-priority:99;
mso-style-link:"Header Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{mso-style-priority:99;
mso-style-link:"Footer Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.HeaderChar
{mso-style-name:"Header Char";
mso-style-priority:99;
mso-style-link:Header;}
span.FooterChar
{mso-style-name:"Footer Char";
mso-style-priority:99;
mso-style-link:Footer;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:windowtext;}
span.EmailStyle22
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Flask community, <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m using Flask to expose exiting (propriety) shell commands over Rest API.
<o:p></o:p></p>
<p class="MsoNormal">Assuming I have “myCommand arg1 arg2 [arg3]” on my server, I’m exposing new API as below:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">URL: <a href="https://%3cIP%3e/myCommand">https://<IP>/myCommand</a>
<br>
json:<o:p></o:p></p>
<p class="MsoNormal">{<o:p></o:p></p>
<p class="MsoNormal"> "arg1":”<value>”,<o:p></o:p></p>
<p class="MsoNormal"> "arg2":”<value>”,<o:p></o:p></p>
<p class="MsoNormal" style="text-indent:.5in">"arg3":”<value>”<o:p></o:p></p>
<p class="MsoNormal">}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">As I have many commands, I prepared an XML file to automate part of the process.
<o:p></o:p></p>
<p class="MsoNormal">The XML contains also validation for arguments and aggregate the API under features.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">An example: <o:p></o:p></p>
<p class="MsoNormal"> <feature name="myFeature"><o:p></o:p></p>
<p class="MsoNormal"> <commands><o:p></o:p></p>
<p class="MsoNormal"> <command url="/myCommand"><o:p></o:p></p>
<p class="MsoNormal"> <must-args><o:p></o:p></p>
<p class="MsoNormal"> <arg key="arg1" type="boolean"/><o:p></o:p></p>
<p class="MsoNormal"> <arg key="arg2" type="int"/><o:p></o:p></p>
<p class="MsoNormal"> </must-args><o:p></o:p></p>
<p class="MsoNormal"> <opt-args><o:p></o:p></p>
<p class="MsoNormal"> <arg key="arg3" type="IP"/><o:p></o:p></p>
<p class="MsoNormal"> </opt-args><o:p></o:p></p>
<p class="MsoNormal"> <bash output="show/ignore"> myCommand {arg1} {arg2} {?arg3:arg3} </bash><o:p></o:p></p>
<p class="MsoNormal"> </command><o:p></o:p></p>
<p class="MsoNormal"> </commands><o:p></o:p></p>
<p class="MsoNormal"> </feature><o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Now, with the above infrastructure, every person in my company can easily expose his own bash commands.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">What do you think on the idea? <o:p></o:p></p>
<p class="MsoNormal">Are there any similar functionalities in Flask I can use instead of developing my own?
<o:p></o:p></p>
<p class="MsoNormal">Assuming the answer is no, do you think it worth contribution?
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thank in advance :) <o:p></o:p></p>
<p class="MsoNormal">Sam <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>