2022-09-24 19:54:08 +08:00
|
|
|
|
# 此库用于实现 52 版不连接程序服务器
|
2022-09-24 21:02:50 +08:00
|
|
|
|
import requests
|
2022-09-24 19:54:08 +08:00
|
|
|
|
|
|
|
|
|
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 = ""
|
|
|
|
|
|
2022-10-26 21:50:59 +08:00
|
|
|
|
def get(url, timeout=None): # -> requests.Response:
|
2022-09-24 19:54:08 +08:00
|
|
|
|
if unConnect:
|
2022-12-04 19:29:09 +08:00
|
|
|
|
# 全部 Url 都拦截
|
|
|
|
|
raise Exception("52专版不支持连接服务器")
|
2022-10-26 21:50:59 +08:00
|
|
|
|
if timeout == None:
|
|
|
|
|
return requests.get(url)
|
|
|
|
|
return requests.get(url, timeout=timeout)
|
2022-09-24 19:54:08 +08:00
|
|
|
|
|
2022-10-26 21:50:59 +08:00
|
|
|
|
def post(url, data, timeout=None):
|
2022-09-24 19:54:08 +08:00
|
|
|
|
if unConnect:
|
2022-12-04 19:29:09 +08:00
|
|
|
|
# 全部 Url 都拦截
|
|
|
|
|
raise Exception("52专版不支持连接服务器")
|
2022-10-26 21:50:59 +08:00
|
|
|
|
if timeout == None:
|
|
|
|
|
return requests.post(url, data)
|
|
|
|
|
return requests.post(url, data, timeout=timeout)
|