from pathlib import Path
import os
import base64
import urllib.request

Vpn_cache = Path("/tmp/vpn_country.cache")
Media_flag = Path("/tmp/media_active")

def rand12():
    return base64.urlsafe_b64encode(os.urandom(9)).decode()[:12]

def http_get(url, timeout=2):
    with urllib.request.urlopen(url, timeout=timeout) as r:
        return r.read().decode().strip()