Skip to content

How to get the job_id for a particular workbook #1275

@DHANOLA

Description

@DHANOLA

Hi there! I would like to ask how can I able to extract all the job IDs for a particular workbook. I can able to access all the jobs but am unable to figure out how to get only the job IDs of a particular workbook.

import tableauserverclient as TSC
import sys
import os
import pandas as pd
import win32com.client
from PyPDF2 import PdfMerger, PdfWriter, PdfFileReader
from datetime import datetime, time, date
import tempfile
import numpy as np
from notifypy import Notify
import shutil
from datetime import timedelta
import pytz

tableau_auth = TSC.TableauAuth('user', 'password', 'site name')
server = TSC.Server('url', use_server_version=True)
timeout_minutes = 300
server.add_http_options({'timeout': timeout_minutes*60})
conn = server.auth.sign_in(tableau_auth)



for i in server.jobs.all():
    if i.created_at!=None and i.started_at!=None and i.ended_at!=None:
                print(i.type,i.id,
          datetime.strptime(str(i.created_at), "%Y-%m-%d %H:%M:%S%z").astimezone(pytz.timezone("Asia/Kolkata")).strftime("%Y-%m-%d %H:%M:%S %Z%z"),
          datetime.strptime(str(i.started_at), "%Y-%m-%d %H:%M:%S%z").astimezone(pytz.timezone("Asia/Kolkata")).strftime("%Y-%m-%d %H:%M:%S %Z%z"),
          datetime.strptime(str(i.ended_at), "%Y-%m-%d %H:%M:%S%z").astimezone(pytz.timezone("Asia/Kolkata")).strftime("%Y-%m-%d %H:%M:%S %Z%z")
          ,i.status)

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedA user needs help, may be a mistake, a bug or a feature request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions