mirror of
https://git.srhtnin.garden/sarah/SaraSuite.git
synced 2026-10-13 18:18:12 +02:00
Release.py: send a User-Agent
This commit is contained in:
1 parent
e4272bd606
commit
9025865a9b
1 file changed
+2
@@ -51,6 +51,8 @@ def Token(Host: str) -> str:
|
||||
def Api(Method: str, Url: str, TokenValue: str, Body: bytes | None = None, ContentType: str = "application/json"):
|
||||
Request = urllib.request.Request(Url, data=Body, method=Method, headers={
|
||||
"Authorization": f"token {TokenValue}", "Content-Type": ContentType, "Accept": "application/json",
|
||||
# Cloudflare's bot check rejects Python's default User-Agent (error 1010).
|
||||
"User-Agent": "SaraSuite-Release (git/2)",
|
||||
})
|
||||
try:
|
||||
with urllib.request.urlopen(Request, timeout=300) as Response:
|
||||
|
||||
Reference in new issue
Block a user