Skip to content

Models Reference

AudioFormat

Bases: StrEnum

List of audio formats accepted by Flowery.

AAC = 'audio/x-aac' class-attribute instance-attribute

AAC audio format.

FLAC = 'audio/x-flac' class-attribute instance-attribute

FLAC audio format.

MP3 = 'audio/mpeg' class-attribute instance-attribute

MP3 audio format.

OPUS = 'audio/ogg; codecs=opus' class-attribute instance-attribute

OGG Opus audio format.

VORBIS = 'audio/ogg; codecs=vorbis' class-attribute instance-attribute

OGG Vorbis audio format.

WAV = 'audio/wav' class-attribute instance-attribute

WAV audio format.

FloweryAPIConfig

Bases: BaseModel

Configuration used when making requests to the Flowery API.

Example
from pyflowery import FloweryAPI, FloweryAPIConfig

config = FloweryAPIConfig(
    user_agent = "PyFloweryDocumentation/1.0.0",
    token = "hello world",
)

api = FloweryAPI(config=config)

base_url = 'https://api.flowery.pw/v2' class-attribute instance-attribute

The base url for the Flowery API.

interval = 5 class-attribute instance-attribute

Seconds to wait between each retried request, multiplied by how many attempted requests have been made.

logger = Field(default_factory=_create_logger) class-attribute instance-attribute

Logger to use for logging messages. One will be automatically created if not provided here.

prepended_user_agent property

Return the user_agent with the PyFlowery module version prepended.

retry_limit = 3 class-attribute instance-attribute

Number of times to retry a request before giving up.

token = None class-attribute instance-attribute

Authorization token to use in HTTP requests. Authorization is only required if you want increased ratelimits. See the Flowery API documentation for more details.

user_agent instance-attribute

User-Agent string to use in HTTP requests. Required as of 2.1.0.

Language

Bases: BaseModel

Language object returned from the Flowery API.

code instance-attribute

The code associated with the language.

name = None class-attribute instance-attribute

The name associated with the language.

Result

Bases: BaseModel

Result returned from low-level RestAdapter.

cache_expires = None class-attribute instance-attribute

The timestamp at which the data in this result will expire, if it was cached by the external API.

Will be None in cases where the external API does not tell us if the result was cached.

cache_hit = None class-attribute instance-attribute

Whether or not the data in this result was returned via a cache from the external API.

Will be None in cases where the external API does not tell us if the result was cached.

data = {} class-attribute instance-attribute

The data returned by the request.

message = '' class-attribute instance-attribute

Human readable result message from the request.

raw_response = None class-attribute instance-attribute

The raw response object from the request.

status_code instance-attribute

The HTTP status code returned by the request.

success instance-attribute

Whether or not the request was successful.

TTSResponse

Bases: BaseModel

Object containing data from a TTS query.

audio_format instance-attribute

What format the data is in.

data instance-attribute

The synthesized TTS data in bytes.

result instance-attribute

The internal result object for use in debugging.

text instance-attribute

The SSML text used to generate the TTS data.

voice = None class-attribute instance-attribute

Whether the text was translated into the voice's set language before being synthesized.

Voice

Bases: BaseModel

Voice object returned from the Flowery API.

gender instance-attribute

Gender of the voice.

id instance-attribute

UUID of the voice.

language instance-attribute

Which language the voice is meant to be used for.

name instance-attribute

Name of the voice.

source instance-attribute

Which provider the voice comes from.