-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathgui_utils.py
More file actions
39 lines (34 loc) · 1.36 KB
/
gui_utils.py
File metadata and controls
39 lines (34 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
Utility functions for the gui
"""
import requests
def fetch_plugin_info() -> dict:
"""
Function to fetch the pulgin information to populate the gui
"""
plugin_info = {}
try:
lines = requests.get(
"https://raw.githubusercontent.com/IBM/ares/refs/heads/main/plugins/README.md", timeout=10
).text.split("\n")
except requests.exceptions.Timeout:
print("Timeout: Could not fetch plugin information")
plugins = lines[
lines.index("| Plugin Name | Description | ARES Component | Example Configs | Dependencies |")
+ 3 : lines.index("## 🧩 Plugin Contribution Guidelines")
- 1
]
plugin_names = [line.split("|")[1].strip().split("]")[0][1:] for line in plugins][0:]
for plugin_name in plugin_names:
for url in [
"https://raw.githubusercontent.com/IBM/ares/refs/heads/main/plugins/" + plugin_name + "/README.md",
"https://raw.githubusercontent.com/IBM/ares/refs/heads/main/plugins/" + plugin_name + "/README.MD",
]:
try:
readme = requests.get(url, timeout=10)
except requests.exceptions.Timeout:
print("Timeout: Could not fetch plugin information")
if readme.text != "404: Not Found":
plugin_info[plugin_name] = readme.text
break
return plugin_info