Skip to content

Commit

Permalink
识别来自 Cloudflare 的报错
Browse files Browse the repository at this point in the history
  • Loading branch information
pooneyy committed Aug 26, 2024
1 parent 34d6b4a commit 3a75af3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
### 更新日志

```
2024.08.26-Based-0.23.11.06.1
识别来自 Cloudflare 的报错。
2023.11.06-Based-0.23.11.06.1
从上游仓库同步更新,Commit:“新增遇到HTTP 403、500、520错误时的处理 (#32)”
同步 新增遇到HTTP 403、500、520错误时的处理(a4bee0b)
Expand Down
5 changes: 4 additions & 1 deletion index.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

DEBUG = False

__verison__ = "2023.12.26-Based-0.23.11.06.1"
__verison__ = "2024.08.26-Based-0.23.11.06.1"

def outputLog(projectName):
log = logging.getLogger(f"{projectName}")
Expand Down Expand Up @@ -379,6 +379,9 @@ def reply(self, url) -> bool:
elif res.text.find("520: Web server is returning an unknown error") != -1:
log.info(f"{self.username} reply failed , HTTP 520 Error")
return True
elif res.text.find("Cloudflare Ray ID") != -1:
log.info(f"{self.username} reply failed , {re.search(r'<title>(.*?)</title>', res.text)}")
return True
else:
log.error(f"{self.username} reply {url} failed , unknown error")
log.error(res.text)
Expand Down

0 comments on commit 3a75af3

Please sign in to comment.