Jaypam001 added a comment.
import requests from jinja2 import Template url = "https://www.mediawiki.org/w/api.php" params = { "action": "query", "list": "abuselog", "format": "json", "origin": "*", "afllimit": "10", "afldir": "newer", "afluser": "ExampleUser", "afltitle": "API", "aflprop": "ids|user|action|result|timestamp|title" } response = requests.get(url, params=params) data = response.json() logs = data['query']['abuselog'] template_html = """ <!DOCTYPE html> <html> <head><title>Filtered Abuse Log</title></head> <body> <h1>Filtered Abuse Log Entries</h1> <ul> {% for log in logs %} <li><strong>ID:</strong> {{ log.id }} | <strong>User:</strong> {{ log.user }} | <strong>Action:</strong> {{ log.action }} | <strong>Result:</strong> {{ log.result }} | <strong>Timestamp:</strong> {{ log.timestamp }} | <strong>Title:</strong> {{ log.title }}</li> {% endfor %} </ul> </body> </html> """ template = Template(template_html) output_html = template.render(logs=logs) with open("abuselog_filtered.html", "w", encoding="utf-8") as f: f.write(output_html) print("Filtered Abuse log page generated!") TASK DETAIL https://phabricator.wikimedia.org/T396298 EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
_______________________________________________ pywikibot-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected]
