mirror of
https://github.com/Arrowar/StreamingCommunity.git
synced 2025-06-07 12:05:35 +00:00
[API] Add verify (#273)
This commit is contained in:
parent
34f6626a58
commit
e43745bbed
@ -58,8 +58,9 @@ def title_search(word_to_search: str) -> int:
|
|||||||
response = httpx.get(
|
response = httpx.get(
|
||||||
url=search_url,
|
url=search_url,
|
||||||
headers={'user-agent': get_userAgent()},
|
headers={'user-agent': get_userAgent()},
|
||||||
follow_redirects=True,
|
timeout=max_timeout,
|
||||||
timeout=max_timeout
|
verify=site_constant.VERIFY,
|
||||||
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -148,7 +148,8 @@ def title_search(title: str) -> int:
|
|||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
json=json_data,
|
json=json_data,
|
||||||
timeout=max_timeout
|
timeout=max_timeout,
|
||||||
|
verify=site_constant.VERIFY
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -58,7 +58,9 @@ def title_search(word_to_search: str) -> int:
|
|||||||
response = httpx.get(
|
response = httpx.get(
|
||||||
url=search_url,
|
url=search_url,
|
||||||
headers={'user-agent': get_userAgent()},
|
headers={'user-agent': get_userAgent()},
|
||||||
timeout=max_timeout
|
timeout=max_timeout,
|
||||||
|
verify=site_constant.VERIFY,
|
||||||
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -60,7 +60,9 @@ def title_search(word_to_search: str) -> int:
|
|||||||
response = httpx.get(
|
response = httpx.get(
|
||||||
url=search_url,
|
url=search_url,
|
||||||
headers={'user-agent': get_userAgent()},
|
headers={'user-agent': get_userAgent()},
|
||||||
timeout=max_timeout
|
timeout=max_timeout,
|
||||||
|
verify=site_constant.VERIFY,
|
||||||
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -58,7 +58,9 @@ def title_search(word_to_search: str) -> int:
|
|||||||
response = httpx.get(
|
response = httpx.get(
|
||||||
url=search_url,
|
url=search_url,
|
||||||
headers={'user-agent': get_userAgent()},
|
headers={'user-agent': get_userAgent()},
|
||||||
timeout=max_timeout
|
timeout=max_timeout,
|
||||||
|
verify=site_constant.VERIFY,
|
||||||
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -55,14 +55,16 @@ def title_search(title_search: str) -> int:
|
|||||||
media_search_manager.clear()
|
media_search_manager.clear()
|
||||||
table_show_manager.clear()
|
table_show_manager.clear()
|
||||||
|
|
||||||
search_url = f"{site_constant.FULL_URL}/api/search?q={title_search}",
|
search_url = f"{site_constant.FULL_URL}/api/search?q={title_search}"
|
||||||
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
console.print(f"[cyan]Search url: [yellow]{search_url}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = httpx.get(
|
response = httpx.get(
|
||||||
url=search_url,
|
url=search_url,
|
||||||
headers={'user-agent': get_userAgent()},
|
headers={'user-agent': get_userAgent()},
|
||||||
timeout=max_timeout
|
timeout=max_timeout,
|
||||||
|
verify=site_constant.VERIFY,
|
||||||
|
follow_redirects=True
|
||||||
)
|
)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
|
|
||||||
|
@ -15,6 +15,9 @@ from StreamingCommunity.Util.console import console
|
|||||||
from StreamingCommunity.Util._jsonConfig import config_manager
|
from StreamingCommunity.Util._jsonConfig import config_manager
|
||||||
|
|
||||||
|
|
||||||
|
# Variable
|
||||||
|
VERIFY = config_manager.get("REQUESTS", "verify")
|
||||||
|
|
||||||
|
|
||||||
def get_tld(url_str):
|
def get_tld(url_str):
|
||||||
"""Extract the TLD (Top-Level Domain) from the URL."""
|
"""Extract the TLD (Top-Level Domain) from the URL."""
|
||||||
@ -79,7 +82,7 @@ def validate_url(url, base_url, max_timeout, max_retries=2, sleep=1):
|
|||||||
return False, None
|
return False, None
|
||||||
|
|
||||||
client = httpx.Client(
|
client = httpx.Client(
|
||||||
verify=False,
|
verify=VERIFY,
|
||||||
headers=get_headers(),
|
headers=get_headers(),
|
||||||
timeout=max_timeout
|
timeout=max_timeout
|
||||||
)
|
)
|
||||||
|
@ -31,6 +31,10 @@ class SiteConstant:
|
|||||||
def ROOT_PATH(self):
|
def ROOT_PATH(self):
|
||||||
return config_manager.get('DEFAULT', 'root_path')
|
return config_manager.get('DEFAULT', 'root_path')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def VERIFY(self):
|
||||||
|
return config_manager.get('REQUESTS', 'verify')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def DOMAIN_NOW(self):
|
def DOMAIN_NOW(self):
|
||||||
return config_manager.get_site(self.SITE_NAME, 'domain')
|
return config_manager.get_site(self.SITE_NAME, 'domain')
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
"telegram_bot": false
|
"telegram_bot": false
|
||||||
},
|
},
|
||||||
"REQUESTS": {
|
"REQUESTS": {
|
||||||
|
"verify": false,
|
||||||
"timeout": 20,
|
"timeout": 20,
|
||||||
"max_retry": 8,
|
"max_retry": 8,
|
||||||
"proxy_start_min": 0.1,
|
"proxy_start_min": 0.1,
|
||||||
|
@ -3,6 +3,7 @@ bs4
|
|||||||
rich
|
rich
|
||||||
tqdm
|
tqdm
|
||||||
m3u8
|
m3u8
|
||||||
|
certifi
|
||||||
psutil
|
psutil
|
||||||
unidecode
|
unidecode
|
||||||
jsbeautifier
|
jsbeautifier
|
||||||
@ -11,5 +12,4 @@ pycryptodomex
|
|||||||
ua-generator
|
ua-generator
|
||||||
qbittorrent-api
|
qbittorrent-api
|
||||||
python-qbittorrent
|
python-qbittorrent
|
||||||
Pillow
|
|
||||||
pyTelegramBotAPI
|
pyTelegramBotAPI
|
Loading…
x
Reference in New Issue
Block a user