콘텐츠로 이동

노드 썸네일 업로드 시작

아래 스크립트 설정 블록에서 시작한 다음, 아래의 스니펫 코드를 추가하세요.

세 단계로 썸네일을 업로드합니다: 시작, 서명된 URL에 바이너리 PUT, 그런 다음 노드 썸네일 업로드 완료로 마무리.

# ... script setup ...
NODE_ID = "your-node-id"
IMAGE_PATH = "thumbnail.png"
init = api_post(f"/v1/nodes/{NODE_ID}/thumbnail", {})
upload_id = init["uploadId"]
upload_url = init["uploadUrl"]
with open(IMAGE_PATH, "rb") as image_file:
put_response = requests.put(
upload_url,
data=image_file.read(),
headers={"Content-Type": "image/png"},
)
put_response.raise_for_status()
api_post(f"/v1/nodes/{NODE_ID}/thumbnail/{upload_id}/finalize", {})
print("Thumbnail applied.")