Skip to content

Commit

Permalink
feat: update action script
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme committed May 31, 2022
1 parent c84cd69 commit e358fbd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import rsa
from retry import retry

from app import log
from app.const import domain, ua, timeout, pubkey

requests.packages.urllib3.disable_warnings()
Expand Down Expand Up @@ -147,8 +148,16 @@ def rebuild_pages(self):
verify=False)
if resp.status_code != 200:
raise Exception(f'Rebuild page error, status code: {resp.status_code}, resp: {resp.text}')
if '请勿频繁更新部署,稍等1分钟再试试看' in resp.text:
html = resp.text
if '正在部署,请耐心等待' in html:
return
if '部署失败' in html and '错误信息' in html:
res = re.search('<p>错误信息:(.*?)<\\\/p>', html, re.S)
if res:
raise Exception(res.group(1).strip())
if '请勿频繁更新部署,稍等1分钟再试试看' in html:
raise Exception('Do not deploy frequently, try again one minute later.')
log.warning(f'Unknown html: {html}')

def run(self):
self.login()
Expand Down
4 changes: 4 additions & 0 deletions app/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ def info(s: str = ''):
core.info(f'[{now()}] {s}')


def warning(s: str = ''):
core.warning(f'[{now()}] {s}')


def error(s: str = ''):
core.info(f'[{now()}] {s}')

Expand Down

0 comments on commit e358fbd

Please sign in to comment.