rogerxavier commited on
Commit
66622b8
·
verified ·
1 Parent(s): 192c13d

Update server/resource.py

Browse files
Files changed (1) hide show
  1. server/resource.py +7 -3
server/resource.py CHANGED
@@ -2,7 +2,7 @@
2
  # -*- coding: utf-8 -*-
3
  import requests
4
  from .utils import headers
5
- from .utils import subscribe_data_decoded
6
 
7
  class Resource:
8
  def __init__(self, url: str):
@@ -11,8 +11,12 @@ class Resource:
11
  self._get_resource()
12
 
13
  def _get_resource(self) -> None:
14
- request = requests.get(self.url,headers=headers)
15
- self.cutted_str = request.text
 
 
 
 
16
 
17
  def get_encoded_data(self) -> str:
18
  return self.cutted_str + ((4 - len(self.cutted_str) % 4) * "=")
 
2
  # -*- coding: utf-8 -*-
3
  import requests
4
  from .utils import headers
5
+
6
 
7
  class Resource:
8
  def __init__(self, url: str):
 
11
  self._get_resource()
12
 
13
  def _get_resource(self) -> None:
14
+ try:
15
+ request = requests.get(self.url, headers=headers)
16
+ self.cutted_str = request.text
17
+ except Exception as e:
18
+ print(f"请求失败,使用之前的cutted_str",self.cutted_str)
19
+
20
 
21
  def get_encoded_data(self) -> str:
22
  return self.cutted_str + ((4 - len(self.cutted_str) % 4) * "=")