주제(topic)의 타임스탬프를 변경하고 싶어서 이 API를 찾았습니다.
하지만 “Bad CSRF” 오류가 발생합니다. 혹시 힌트를 주실 수 있을까요? 감사합니다.
import requests
# 잘못된 헤더
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']
