deep-wine-runner/req/__init__.py
2023-03-19 15:49:49 +08:00

28 lines
902 B
Python
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 此库用于实现 52 版不连接程序服务器(不再区分)
import requests
unConnect = False
# 不再区分吾爱版
#with open("/var/lib/dpkg/status", "r") as i:
# unConnect = "Package: spark-deepin-wine-runner-52" in open("/var/lib/dpkg/status", "r").read()
#if unConnect:
# print("52专版将会无法连接服务器")
class Respon:
text = ""
def get(url, timeout=None): # -> requests.Response:
#if unConnect:
# 全部 Url 都拦截
#raise Exception("52专版不支持连接服务器")
if timeout == None:
return requests.get(url)
return requests.get(url, timeout=timeout)
def post(url, data, timeout=None):
#if unConnect:
# 全部 Url 都拦截
# raise Exception("52专版不支持连接服务器")
if timeout == None:
return requests.post(url, data)
return requests.post(url, data, timeout=timeout)