以前はユーザーを生成し、投稿に「いいね」をつけるスクリプトを 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]{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()
)
その後、投稿を生成して送信していました。しかし、ここ 1 ヶ月の間に動作が停止し、400 エラーしか返されなくなりました。
このスクリプトは以前は完全に正常に動作していました。私が気づいていない変更があったのでしょうか?
