Skip to content ka sehloohong

Theha Quotes Post

Mohlaleng ona re tla sheba mokhoa oa ho theha poso ea Quotes u sebelisa Predis.ai API. Re tla beha boleng ba post_type ho quotes le boleng ba media_type parameter ho single_image. Hajoale feela single_image e tšehetsoa bakeng sa ho hlahisa poso ea Quotes ka hona boleng bo bong ho media_type tla hloleha.

U ka fana ka mongolo oa 'nete oa qotso eo u batlang ho e kenyelletsa posong u sebelisa text paramethara. Optionally, u ka boela kenyeletsa le author parameter ho hlahisa lebitso la mongoli posong.

import requests, json

url = "https://brain.predis.ai/predis_api/v1/create_content/"

payload = {
"brand_id": "YOUR_BRAND_ID",
"text": "All our dreams can come true if we have the courage to pursue them",
"media_type": "single_image",
"author": "Walt Disney", # optional
"template_ids": json.dumps(["TEMPLATE_ID_1"]), # pass template_ids if you want quotes in specific design
"post_type": "quotes",
"model_version": "2", # Quotes not supported by model_version 4
}

headers = {"Authorization": "YOUR_API_KEY"}

response = requests.request("POST", url, data=payload, headers=headers)

if response.status_code == 200:
json_response = response.json()
post_id = json_response.get("post_id")
post_status = json_response.get("status")

else:
print("Error occurred - {}".format(response.text))

Haeba u fumana file ea inProgress boemo ha u arabela, kopo ea hau e atlehile 'me poso ea Quotes e ntse e hlahisoa. Hang ha poso ea Quotes e hlahisoa ka katleho (kapa e hloleha), u tla fumana kopo ho URL ea hau ea webhook e nang le lintlha tse ling.