connect.schedules

connect.schedules

Schedule resources.

Attributes

Name Description
ScheduleType

Classes

Name Description
Schedule A schedule for rendering a variant of a content item.
Schedules Manager for the render schedule of a single variant.

Schedule

connect.schedules.Schedule(ctx, /, **kwargs)

A schedule for rendering a variant of a content item.

Warnings

The schedule API is experimental and may change in future releases.

Attributes

Name Description
rule The decoded per-type schedule parameters.

Methods

Name Description
destroy Destroy the schedule.
destroy
connect.schedules.Schedule.destroy()

Destroy the schedule.

Warnings

This operation is experimental and may change in future releases.

Schedules

connect.schedules.Schedules(ctx, *, app_id, variant_id)

Manager for the render schedule of a single variant.

A variant has at most one schedule.

Warnings

The schedule API is experimental and may change in future releases. Accessing it via ContentItem.schedule or Variant.schedules emits a FutureWarning.

Attributes

Name Description
app_id
variant_id

Methods

Name Description
create Create or update the schedule for this variant.
delete Delete the schedule for this variant.
find_one Find the schedule for this variant.
create
connect.schedules.Schedules.create(
    type,
    start_time=None,
    timezone=None,
    email=None,
    **kwargs,
)

Create or update the schedule for this variant.

If the variant is not scheduled, a new schedule is created. Otherwise, the provided fields are merged over the existing schedule.

New schedules are created with activation enabled (matching the Connect dashboard): each successful render is published as the variant’s current rendering, making it what viewers see. Updates preserve the schedule’s existing activation setting.

Parameters
Name Type Description Default
type str The recurrence type. One of "minute", "hour", "day", "weekday" (every Monday through Friday), "week", "dayofweek", "semimonth", "dayofmonth", "dayweekofmonth", or "year". required
n int Render every n minutes/hours/days/weeks/months/years, depending on type. Required for "minute", "hour", "day", "week", and "year"; optional (default 1) for "dayofmonth" and "dayweekofmonth". required
days Sequence[int | str] For "dayofweek": the days of the week on which to render. Integers between 0 (Sunday) and 6 (Saturday), or case-insensitive day names (e.g. "monday"). Note the integer encoding differs from Python’s datetime.weekday(), where 0 is Monday. required
first bool For "semimonth": True to render on the 1st and 15th of the month, False to render on the 14th and the last day of the month. Default True. required
day int For "dayofmonth": the day of the month, between 1 and 31. For "dayweekofmonth": the day of the week, between 0 (Sunday) and 6. required
week int For "dayweekofmonth": the week of the month, between 0 and 5. required
start_time datetime | str When the schedule takes effect. Strings are passed through unchanged and must be RFC 3339 timestamps; datetimes are converted to UTC, with naive datetimes assumed to be UTC. When creating a schedule, defaults to the current time; when updating, the existing value is kept. None
timezone str The IANA timezone in which the schedule is interpreted (e.g. "America/New_York"). When creating a schedule, defaults to "UTC"; when updating, the existing value is kept. See GET v1/timezones for valid values. None
email bool Whether to send an email upon rendering. When creating a schedule, defaults to False; when updating, the existing value is kept. None
Returns
Name Type Description
Schedule
Warnings

This operation is experimental and may change in future releases.

Examples
from posit import connect

client = connect.Client()
content = client.content.get("CONTENT_GUID_HERE")

# Render every Monday and Wednesday at the current time of day
content.schedule.create(
    type="dayofweek",
    days=["monday", "wednesday"],
    timezone="America/New_York",
)

# Render every 2 hours
content.schedule.create(type="hour", n=2)

# Render on the 1st and 15th of each month
content.schedule.create(type="semimonth", first=True)
delete
connect.schedules.Schedules.delete()

Delete the schedule for this variant.

Idempotent: does nothing if the variant is not scheduled.

Warnings

This operation is experimental and may change in future releases.

find_one
connect.schedules.Schedules.find_one()

Find the schedule for this variant.

Returns
Name Type Description
Schedule | None The current schedule, or None if the variant is not scheduled.