티스토리 뷰

공부

[tableau] image & pdf

승가비 2022. 12. 28. 10:47
728x90
from config import TABLEAU
import tableauserverclient as TSC

from util import timestamp

auth = TSC.PersonalAccessTokenAuth(
    TABLEAU["TOKEN_NAME"],
    TABLEAU["TOKEN_VALUE"],
)
server = TSC.Server(
    TABLEAU["SERVER_URL"],
    use_server_version=True
)

target = "asdf"
with server.auth.sign_in(auth):
    for v in TSC.Pager(server.views):
        if target == v.name:
            view = v
            break

    server.views.populate_pdf(view, TSC.ImageRequestOptions())
    server.views.populate_image(view, TSC.PDFRequestOptions())

    ts = timestamp()
    with open(f"{ts}.pdf", "wb") as f:
        f.write(view.pdf)
    with open(f"{ts}.png", "wb") as f:
        f.write(view.image)

https://velog.io/@kimseon125125/log-5-%ED%83%9C%EB%B8%94%EB%A1%9C-%EC%9D%B4%EB%AF%B8%EC%A7%80-%EC%8A%AC%EB%9E%99%EC%9C%BC%EB%A1%9C-%EB%B3%B4%EB%82%B4%EA%B8%B0

 

log 3 - 태블로 이미지를 슬랙으로 보내기 (1)

python으로 태블로 이미지 다운로드 받는 자동화 모듈 만들기

velog.io

https://www.phdata.io/blog/how-to-use-tableau-server-client-in-python/

 

How to Use Tableau Server Client in Python: Querying View Image

Learn how to save time querying view images in Tableau by integrating the Tableau Server Client library in Python in this step-by-step tutorial.

www.phdata.io

 

728x90
댓글