Ṣẹda Quotes Post
Ninu apẹẹrẹ yii a yoo wo bii o ṣe le ṣẹda ifiweranṣẹ Awọn ọrọ nipa lilo awọn Predis.ai API. A yoo ṣeto iye ti post_type si quotes ati iye ti media_type paramita si single_image. Lọwọlọwọ nikan single_image ni atilẹyin fun ti ipilẹṣẹ Ifiweranṣẹ Awọn asọye ati nitorinaa eyikeyi iye miiran ninu media_type yoo kuna.
O le pese ọrọ gangan ti agbasọ ti o fẹ lati fi sii ninu ifiweranṣẹ ni lilo awọn text paramita. Ni yiyan, o tun le pẹlu awọn author paramita lati ṣafihan orukọ onkọwe ninu ifiweranṣẹ naa.
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))
Ti o ba gba a inProgress ipo ni idahun, ibeere rẹ ṣaṣeyọri ati pe ifiweranṣẹ Quotes ti wa ni ipilẹṣẹ. Ni kete ti ifiweranṣẹ Quotes ti ipilẹṣẹ ni aṣeyọri (tabi kuna), iwọ yoo gba ibeere kan lori URL oju opo wẹẹbu ti iṣeto pẹlu awọn alaye diẹ sii.