def query_user(**kwargs):
    user_id = kwargs['user_id']
    conn = TableauServerConnection(config_json=tableau_server_config)
    conn.sign_in()
    user_data = conn.query_user_on_site(user_id)
    print(user_data.json())
    conn.sign_out()
def main():
    print(pd.datetime.now())
    conn = TableauServerConnection(config_json=tableau_server_config)
    conn.sign_in()
    print(os.listdir(os.getcwd()))
    users_json = conn.get_users_on_site().json()
    print(users_json)
    conn.sign_out()
def main():
    conn = TableauServerConnection(config_json=tableau_server_config)
    conn.sign_in()
    users = conn.get_users_on_site().json()
    print("pandas datetime: ", pd.datetime.now())
    print('Fetched users from server {}'.format(conn.server))
    print(users)
    print(conn.server_info().json())
    conn.sign_out()
Example #4
0
print(schedule_id.json()['pagination']['totalAvailable'])

# create a loop over the number of times of schedules present
for i in range(int(schedule_id.json()['pagination']['totalAvailable'])):
    # changing the schedule priority if the name of the schedule is equal to a ceratin name
    if schedule_id.json(
    )['schedules']['schedule'][i]['name'] == 'Weekday early mornings':
        # printing the value of curremt schedule priority
        print(schedule_id.json()['schedules']['schedule'][i]['priority'])

        # updating the priority of the schedule
        conn.update_schedule(
            schedule_id.json()['schedules']['schedule'][i]['id'],
            schedule_priority=schedule_priority)

# accesing the dataframe of all schedules (also another option to access all schedules)

get_schedule_info = get_schedules_dataframe(conn)
"""print(get_schedule_info)
print(get_schedule_info.columns)
print(get_schedule_info.loc[get_schedule_info['name']== 'Weekday early mornings']['priority'])"""

if int(get_schedule_info.loc[get_schedule_info['name'] ==
                             'Weekday early mornings']
       ['priority']) == schedule_priority:
    print(f'Schedule priority Updated to {schedule_priority}')
else:
    print('Schedule priority not updated')

conn.sign_out()
Example #5
0
def get_basic_auth_responses():
    conn = TableauServerConnection(tableau_server_config)
    sign_in_response = conn.sign_in()
    sign_out_response = conn.sign_out()
    return sign_in_response, sign_out_response