MCPcopy Index your code
hub / github.com/RiotGames/developer-relations / json2table

Function json2table

sample_apps/rso_sample_apps/python/main.py:71–105  ·  view source on GitHub ↗
(json)

Source from the content-addressed store, hash-verified

69
70
71def json2table(json):
72 style = """
73 <style type="text/css">
74 .tg {border-collapse:collapse;border-spacing:0;}
75 .tg td{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
76 overflow:hidden;padding:10px 5px;word-break:normal;}
77 .tg th{border-color:black;border-style:solid;border-width:1px;font-family:Arial, sans-serif;font-size:14px;
78 font-weight:normal;overflow:hidden;padding:10px 5px;word-break:normal;}
79 .tg .tg-0lax{text-align:left;vertical-align:top}
80 </style>"""
81
82 html = """
83 <table class="tg">
84 <thead>
85 <tr>
86 <th class="tg-0lax">key</th>
87 <th class="tg-0lax">value</th>
88 </tr>
89 </thead>
90
91 <tbody>"""
92
93 for key, value in json.items():
94 html += f"""
95 <tr>
96 <td class="tg-0lax">{key}</td>
97 <td class="tg-0lax">{value}<br></td>
98 </tr>"""
99
100 html += """
101 </tbody>
102 </table>
103 """
104
105 return style + html
106
107
108@app.get("/show-data/", response_class=HTMLResponse)

Callers 1

show_dataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected