-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgittest.py
52 lines (42 loc) · 1.15 KB
/
gittest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
import logging
import logging.config
import os
import re
import time
from hashlib import md5
from typing import List, Optional
from urllib.parse import urlencode
import httpx
def chicken_checkin() -> None:
"""几鸡签到
"""
logger = logging.getLogger("chicken")
client = httpx.Client()
email = os.environ["CHICKEN_MAIL"]
passwd = os.environ["CHICKEN_PASSWORD"]
login_resp = client.post(
"http://j01.space/signin",
headers={"Content-Type": "application/json;charset=UTF-8"},
content=json.dumps(
{"email": email, "passwd": passwd},
separators=(",", ":")
)
)
logger.info(login_resp.json())
checkin_resp = client.post(
"http://j01.space/user/checkin"
)
logger.info(checkin_resp.json())
if __name__ == "__main__":
errors = [] # type: List[Optional[Exception]]
for func in (
chicken_checkin,
):
try:
func()
except Exception as e:
errors.append(e)
for er in errors:
if isinstance(er, Exception):
raise er