24 lines
684 B
Python
Executable File
24 lines
684 B
Python
Executable File
from bs4 import BeautifulSoup
|
|
import requests
|
|
import random
|
|
|
|
|
|
def request_wiki(url, heading):
|
|
response = requests.get(
|
|
"https://escapefromtarkov.fandom.com/wiki/Category:" + url, timeout=25
|
|
).text
|
|
soup = BeautifulSoup(response, "html.parser")
|
|
h2_heading = soup.find("h2", string=f'Pages in category "{heading}"')
|
|
return [link.text for link in h2_heading.find_next("div").find_all("a")]
|
|
|
|
|
|
def allowed_level_roll():
|
|
message = "None"
|
|
allowed = random.randint(0, 1) == 1
|
|
if allowed:
|
|
message = "Allowed"
|
|
message += ", Trader level: " + random.choice(
|
|
[str(random.randint(1, 4)), "Any level"]
|
|
)
|
|
return message
|