Open gdrau opened 1 month ago
From the REST API documentation:
If subscriptions to attachments are disabled in Tableau server or site settings, then making a request that sets attachImage to false will cause an error.
the parameters are true and not false in my script. So when I manually create the subscription or when I use a request it works. So I don't understand why it doesn't work
What happens if you set image to True, pdf to False, and remove the pdf specific options? Try the simplest case first.
the same
?? Help me :-)
My minimally reproducible example works. edit: Also attaching image. Still works.
# /// script
# requires-python = ">=3.10
# dependencies = [
# "tableauserverclient>=0.32.0",
# "python-dotenv"
# ]
# ///
import os
from dotenv import load_dotenv
import tableauserverclient as TSC
load_dotenv()
auth = TSC.PersonalAccessTokenAuth(
token_name=os.environ["TABLEAU_TOKEN_NAME"],
personal_access_token=os.environ["TABLEAU_PAT"],
site_id=os.environ["TABLEAU_SITE"]
)
server = TSC.Server(os.environ["SERVER_ADDRESS"], use_server_version=True)
with server.auth.sign_in(auth):
workbook = server.workbooks.filter(name="Team Metrics")[0]
target = TSC.Target(workbook.id, "workbook")
# Pick a random schedule for testing purposes
sched = next(s for s in TSC.Pager(server.schedules) if s.schedule_type == TSC.ScheduleItem.Type.Subscription)
sub = TSC.SubscriptionItem("message", schedule_id=sched.id, user_id=server.user_id, target=target)
sub.attach_image = True
sub.attach_pdf = True
sub.page_orientation = TSC.PDFRequestOptions.Orientation.Portrait
sub.page_size_option = TSC.PDFRequestOptions.PageType.A4
sub.send_if_view_empty = True
sub = server.subscriptions.create(sub)
Hello, I'm trying to create a subscription for a user on a view. I put this piece of code, schedule_id = '60c392fc-d902-44b0-92cf-cfa3b512630f' user_id = df[0].values[i]
Create the new SubscriptionItem object with variables from above.
I launch it and when I have the error it gives me 0x5CE10192 : Specifying subscription attachments not allowed.
THanks
Version : Product version: 2024.2.0 REST API version: 3.23 Build number: 20242.24.0711.1807 Python 3.10.6