voip:cisco7940-7960
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| voip:cisco7940-7960 [16/09/2024 09:46] – created - external edit 127.0.0.1 | voip:cisco7940-7960 [12/06/2025 15:14] (current) – [Cisco XML Services] andrew | ||
|---|---|---|---|
| Line 212: | Line 212: | ||
| [[https:// | [[https:// | ||
| + | |||
| + | Flask based code to generate XML:- | ||
| + | |||
| + | <code python> | ||
| + | from flask import Flask, request, render_template, | ||
| + | |||
| + | |||
| + | app = Flask(__name__) | ||
| + | |||
| + | |||
| + | # See https:// | ||
| + | |||
| + | @app.route('/ | ||
| + | def xml_response(): | ||
| + | # Define sample data to be returned as XML | ||
| + | data0 = { | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | |||
| + | data1 = { | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | |||
| + | # Convert data to XML format | ||
| + | xml_data = f""" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | """ | ||
| + | |||
| + | # Create a response with the XML content type | ||
| + | response = Response(xml_data, | ||
| + | return response | ||
| + | |||
| + | |||
| + | @app.route('/ | ||
| + | def xml_opt0_response(): | ||
| + | # Define sample data to be returned as XML | ||
| + | data0 = { | ||
| + | ' | ||
| + | ' | ||
| + | } | ||
| + | |||
| + | # Convert data to XML format | ||
| + | xml_opt0_data = f""" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | """ | ||
| + | |||
| + | # Create a response with the XML content type | ||
| + | response = Response(xml_opt0_data, | ||
| + | return response | ||
| + | </ | ||
| Line 219: | Line 293: | ||
| [[https:// | [[https:// | ||
| + | [[https:// | ||
| + | |||
| + | ---- | ||
| + | |||
| + | This page has been accessed:- \\ | ||
| + | Today: {{counter|today}} \\ | ||
| + | Yesterday: {{counter|yesterday}} \\ | ||
| + | Until now: {{counter|total}} \\ | ||
voip/cisco7940-7960.1726479992.txt.gz · Last modified: by 127.0.0.1
