mirror of
https://github.com/PaiGramTeam/Gift-Code-Web.git
synced 2024-11-21 14:48:27 +00:00
🐛 Fix Error UTC Timezone
This commit is contained in:
parent
b673997f95
commit
e6be7a0e61
2
add.py
2
add.py
@ -1,4 +1,5 @@
|
||||
from pathlib import Path
|
||||
from pytz import timezone
|
||||
from sys import argv
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
@ -16,6 +17,7 @@ def add(code: str, expire_str: str, rewards_str: List[str]) -> Code:
|
||||
else:
|
||||
expire = datetime.strptime(expire_str, "%Y-%m-%d")
|
||||
expire = expire.replace(hour=23, minute=59, second=59, microsecond=999999)
|
||||
expire = timezone("Asia/Shanghai").localize(expire)
|
||||
rewards = []
|
||||
for reward_str in rewards_str:
|
||||
reward_list = reward_str.split(":")
|
||||
|
@ -8,7 +8,7 @@
|
||||
"cnt": 60
|
||||
}
|
||||
],
|
||||
"expire": 1689724799999
|
||||
"expire": 1689695999999
|
||||
},
|
||||
{
|
||||
"code": "9A6BHRKX4XNL",
|
||||
|
@ -1,4 +1,5 @@
|
||||
import re
|
||||
from pytz import timezone
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
@ -57,6 +58,7 @@ def parse_code(tr: Tag) -> Code:
|
||||
now = datetime.now()
|
||||
expire = datetime.strptime(f"{day} {month}", "%d %b")
|
||||
expire = expire.replace(year=now.year, hour=23, minute=59, second=59, microsecond=999999)
|
||||
expire = timezone("Asia/Shanghai").localize(expire)
|
||||
expire = int(expire.timestamp() * 1000)
|
||||
rewards = []
|
||||
for reward in tds[1].find_all("div", {"class": "flex"}):
|
||||
|
@ -2,3 +2,4 @@ pydantic
|
||||
httpx
|
||||
beautifulsoup4
|
||||
lxml
|
||||
pytz
|
||||
|
Loading…
Reference in New Issue
Block a user