|
13 | 13 |
|
14 | 14 | DEBUG = False
|
15 | 15 |
|
16 |
| -__verison__ = "2023.09.13-Based-0.23.09.07.1" |
| 16 | +__verison__ = "2023.10.24-Based-0.23.10.24.1" |
17 | 17 |
|
18 | 18 | def outputLog(projectName):
|
19 | 19 | log = logging.getLogger(f"{projectName}")
|
@@ -96,13 +96,12 @@ def deco(*args , **kargs):
|
96 | 96 | return deco
|
97 | 97 |
|
98 | 98 | def save_cookies(session : requests.Session , filename : str) -> None:
|
99 |
| - ... |
100 |
| - # with open(filename, 'wb') as f: |
101 |
| - # try: |
102 |
| - # pickle.dump(session.cookies, f) |
103 |
| - # log.debug(f"save {filename} success") |
104 |
| - # except: |
105 |
| - # ... |
| 99 | + try: |
| 100 | + with open(filename, 'wb') as f: |
| 101 | + pickle.dump(session.cookies, f) |
| 102 | + log.debug(f"save {filename} success") |
| 103 | + except: |
| 104 | + ... |
106 | 105 |
|
107 | 106 | def load_cookies(session : requests.Session , filename : str) -> None:
|
108 | 107 | with open(filename, 'rb') as f:
|
@@ -348,6 +347,9 @@ def reply(self, url) -> bool:
|
348 | 347 | elif res.text.find("該貼已被鎖定") != -1:
|
349 | 348 | log.info(f"{self.username} reply failed , the thread is locked")
|
350 | 349 | return True
|
| 350 | + elif res.text.find("502 Bad Gateway") != -1: |
| 351 | + log.info(f"{self.username} reply failed , HTTP 502 Error") |
| 352 | + return True |
351 | 353 | else:
|
352 | 354 | log.error(f"{self.username} reply {url} failed , unknown error")
|
353 | 355 | log.error(res.text)
|
|
0 commit comments