PixelLauncher 2.1.2 — секции настроек, панель быстрых настроек, сборки Modrinth/CurseForge
This commit is contained in:
1 parent
80dc1826a1
commit
39cf752b7b
13 files changed
+972
-49
No files matched your search
+9
-3
@@ -13,7 +13,7 @@ import struct
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
USER_AGENT = "PixelLauncher/2.1.1 (lightweight Minecraft launcher)"
|
||||
USER_AGENT = "PixelLauncher/2.1.2 (lightweight Minecraft launcher)"
|
||||
ATTEMPTS = 4
|
||||
|
||||
_opener = None # настроенный opener (прокси) или None — напрямую в сеть
|
||||
@@ -173,12 +173,18 @@ def _open(req, timeout=30):
|
||||
return urllib.request.urlopen(req, timeout=timeout)
|
||||
|
||||
|
||||
def get_bytes(url, timeout=30):
|
||||
def get_bytes(url, timeout=30, headers=None):
|
||||
last = None
|
||||
n = 0
|
||||
hdrs = {"User-Agent": USER_AGENT}
|
||||
if headers:
|
||||
try:
|
||||
hdrs.update(headers)
|
||||
except Exception:
|
||||
pass
|
||||
for u, mprefix in _attempt_urls(url):
|
||||
try:
|
||||
req = urllib.request.Request(u, headers={"User-Agent": USER_AGENT})
|
||||
req = urllib.request.Request(u, headers=hdrs)
|
||||
with _open(req, timeout=timeout) as r:
|
||||
return r.read()
|
||||
except Exception as e: # noqa: BLE001
|
||||
|
||||
Reference in new issue
Block a user