Waihanga Panui Korero
I roto i tenei tauira ka titiro tatou ki te hanga i tetahi Quotes pou ma te whakamahi i te Predis.ai API. Ka whakatauhia e matou te uara o post_type Tuhinga o mua quotes me te uara o media_type tawhā ki single_image. I tenei wa anake single_image e tautokohia ana mo te whakaputa i nga panui Quotes a no reira etahi atu uara kei roto media_type ka taka.
Ka taea e koe te whakarato i te tuhinga tuuturu o te korero e hiahia ana koe ki te whakauru ki te panui ma te whakamahi i te text tawhā. Ka taea, ka taea hoki e koe te whakauru i te author tawhā hei whakaatu i te ingoa kaituhi ki te whakairinga.
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))
Mena ka whiwhi koe i te inProgress te mana hei whakautu, kua angitu to tono, kei te hangahia te panui Quotes. Ina oti pai te whakaputanga o nga korero (ka rahua ranei), ka whiwhi koe i te tono ki to URL hook tukutuku kua whirihorahia me etahi atu korero.