2020-10-12 15:45:31 +02:00
|
|
|
import random
|
2022-08-15 13:19:48 +02:00
|
|
|
from typing import Optional
|
2020-10-12 15:45:31 +02:00
|
|
|
|
2020-10-09 10:40:37 +02:00
|
|
|
import requests
|
|
|
|
|
|
|
|
|
2022-08-15 13:19:48 +02:00
|
|
|
def http_get(url: str) -> Optional[str]:
|
2020-10-09 10:40:37 +02:00
|
|
|
response = requests.get(url)
|
|
|
|
if response.status_code == 200:
|
|
|
|
return response.text
|
2022-08-15 13:19:48 +02:00
|
|
|
return None
|
2020-10-12 15:45:31 +02:00
|
|
|
|
2022-08-09 23:47:28 +02:00
|
|
|
|
2022-08-15 13:19:48 +02:00
|
|
|
def proc(proba_percentage: int) -> bool:
|
2020-10-12 15:45:31 +02:00
|
|
|
return random.random() < (proba_percentage / 100.0)
|