liumiaomiao 1 年之前
父节点
当前提交
865be65ad8
共有 2 个文件被更改,包括 3 次插入4 次删除
  1. 2 2
      lib/linkapi.py
  2. 1 2
      lib/webapi.py

+ 2 - 2
lib/linkapi.py

@@ -7,7 +7,7 @@ class APILink():
     #打开链接,返回title
     def obtain_url_title(self,url):
         response = requests.get(url,headers = {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'})
+        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36;jy-test'})
         response.encoding = 'utf-8'  # 设置编码为utf-8
         soup = BeautifulSoup(response.text, 'html.parser')
         title = soup.title.string
@@ -16,7 +16,7 @@ class APILink():
     #打开链接,status=200,返回true
     def open_url_status(self,url):
         response = requests.get(url,headers = {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'})
+        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36;jy-test'})
         status_code = response.status_code
         if status_code==200:
             return True

+ 1 - 2
lib/webapi.py

@@ -40,8 +40,7 @@ class APIMgr():
 
 
     headers = {
-
-        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67"
+        "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 Edg/114.0.1823.67;jy-test"
     }
 
     #headers设置为全局变量