Changeset

3809:a70f5a6c7f01

mod_rest: Apply Python source formatting on example
author Kim Alvefur <zash@zash.se>
date Wed, 01 Jan 2020 12:08:25 +0100
parents 3808:02164f8aebac
children 3810:91ff86fc3b20
files mod_rest/README.markdown
diffstat 1 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mod_rest/README.markdown	Wed Jan 01 12:06:46 2020 +0100
+++ b/mod_rest/README.markdown	Wed Jan 01 12:08:25 2020 +0100
@@ -123,20 +123,26 @@
 from flask import Flask, Response, request
 import xml.etree.ElementTree as ET
 
-app = Flask('echobot')
+app = Flask("echobot")
+
 
 @app.before_request
 def parse():
     request.stanza = ET.fromstring(request.data)
 
-@app.route('/', methods = ['POST'])
+
+@app.route("/", methods=["POST"])
 def hello():
-    if request.stanza.tag == 'message':
-        return Response('<message><body>Yes this is bot</body></message>', content_type='application/xmpp+xml')
+    if request.stanza.tag == "message":
+        return Response(
+            "<message><body>Yes this is bot</body></message>",
+            content_type="application/xmpp+xml",
+        )
 
-    return Response(status = 501)
+    return Response(status=501)
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     app.run()
 ```