我想更改主题的时间戳,找到了这个 API
但是,它出现了“Bad CSRF”错误,有人能给点提示吗?谢谢
import requests
# 错误的 headers
headers = {
"Authorization": f"Apikey {api_key}",
"User-Agent": api_username
}
# 正确的
headers = {"Content-Type": "application/json; charset=utf-8", "Api-Key": api_key, "Api-Username": api_username }
# 修改帖子日期
created_at = "1701417600"
update_data = {"timestamp": created_at}
response = requests.put(f"https://www.mysite.com/t/6532/change-timestamp.json", json=update_data, headers=headers)
print(response.status_code) # 403
print(response.text) # '["BAD CSRF"]'
print(response.json()) # ['BAD CSRF']
