Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How can I change the python tool's Jupyter IOPub defauilt limits?

hroderick-thr
11 - Bolide

Using the Interactive side of the python tool to run a curl api that gets json data returns the error below. The API is  Alteryx's v1 workflows and it is returning info on all the workflows on our server. It is a list of several hundred, but not enormous in size. The python works fine when run from the desktop instead of interactive.  How can I change the python tool's Jupyter IOPub defauilt limits?

 

I see in the error it says it is in the config. Where is the config that the python tool is using ?

 

 

Capture.JPG

 

1 REPLY 1
hroderick-thr
11 - Bolide

I figured it out and wanted to share this rung on my python-API learning ladder. If you found this post this may help you too.

It was returning over 2800 workflows from our gallery. I used the offset and limit parameters inside a loop to pull 200 at a time and the problem went away.

Here is the lightly obfuscated python code that works. Bring your own token and server values

 

 

    import requests 
    import json 
    import pandas

    offset = 0
    limit = 200
    all_data = []

    headers = {
        "Accept": "application/json",
        "Authorization": "Bearer " + YOURTOKEN  
        }

    url = "http://YOURSERVER/webapi/admin/v1/workflows"

    while True:
        params = {
            "offset": offset,
            "limit": limit
            }

        response = requests.get(url, headers=headers, params=params)

        if response.status_code == 200:
            data = response.json()
            if not data:
                break  # No more data to fetch, exit the loop
            all_data.extend(data)
            offset += limit
        else:
            print(f"Failed to retrieve data. Status code: {response.status_code}")
            break

    # Convert the list of dictionaries to a pandas DataFrame
    df = pandas.DataFrame(all_data)

    # Now you have all the data in a single DataFrame
    print("rows " + str(len(df.index)))
    print(df.head())  # You can print the first few rows to check the data

 

Polls
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Labels