我有一段 Python 代码片段,之前它能生成用户并让该用户点赞帖子。
i = i + extra
pw = nanoid.generate(size=150)
name = f"User{nanoid.generate(size=5, alphabet='abcdefghijklmnopqrstuvwxyz')}.{i}"
username = str(name)
print(f"spam_{i}@notpyx.me")
resp = httpx.post(
url="https://discourse.pyxfluff.dev/users.json",
json={
"name": f"User.{i}",
"email": f"discourse.{i}@notpyx.me",
"username": username,
"password": str(pw),
"active": True,
"approved": True,
},
headers={"Api-Key": API_KEY, "Api-Username": "system"},
)
resp.raise_for_status()
rp(f"[green]Made {username}: {pw}[/]")
if like_post_id:
try:
print(
httpx.post(
url="https://discourse.pyxfluff.dev/post_actions.json",
json={"id": int(like_post_id), "post_action_type_id": 2},
headers={"Api-Key": API_KEY, "Api-Username": username},
).json()
)
之后它还会生成并发送帖子。然而,在过去的一个月里,它突然停止工作了,只返回 400 错误。
这段脚本之前运行得非常完美。是不是有什么变化是我不知道的?
