MCPcopy Create free account
hub / github.com/geekcomputers/Python / lang

Function lang

Wikipdedia/practice_beautifulsoap.py:7–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

5
6
7def lang():
8 try:
9 response = requests.get("https://www.wikipedia.org/")
10 response.raise_for_status()
11 soup = BeautifulSoup(response.content, "html.parser")
12
13 for option in soup.find_all("option"):
14 language = option.text
15 symbol = option["lang"]
16 language_symbols[language] = symbol
17
18 return list(language_symbols.keys())
19
20 except requests.exceptions.RequestException as e:
21 print("Error fetching language data:", e)
22 return []
23
24
25def data(selected_topic, selected_language):

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected