Join the Alteryx Community’s Maveryx Summer Cup event! Compete, network with others, and earn your gold through a series of challenges from July 24th to August 11th. Learn more about the event here.

Alteryx Designer Desktop Discussions

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

Invoke a macro from a python script and get the result back

fardeen9983
8 - Asteroid

I have a macro that generates an OAuth token which is passed to a python script.

The token expires and this is detected in the python code.

What I need is to re invoke the macro and get a new token from it and continue execution in python script

 

P.S - Cant upload the workflow

3 REPLIES 3
BrandonB
Alteryx
Alteryx

Is the Python script making the API call? You might just want to bring the Oauth step into the Python tool if that is the case and handle the loop in there. Otherwise you might want to bring the API call into the Alteryx workflow and use an iterative macro to loop through and handle the refresh step. 

fardeen9983
8 - Asteroid

The python script is making a series of api call and has to be kept apart from Oauth part for reuse in different project. So auth and api calls are to be kept separate. 

I can't use iterative macro as the number of api calls/iterations in the script is dynamic and cannot be set beforehand.

 

So is there any way to make a part of the workflow run again and pass a new token?

 

 

BrandonB
Alteryx
Alteryx

The only way for a workflow to loop is via macro. The only way I could see you kicking off the Oauth process again would be maybe by using the Runner or conditional runner Macro https://community.alteryx.com/t5/Alteryx-Designer-Knowledge-Base/CReW-Macro-Support/ta-p/465740

 

You could in theory leverage the runner macro to kick off the Oauth process again, but I'm not sure what mechanism you would use in the Python script to pass through the calls that haven't completed into a second step. If you really want to use Python for the API calls you may just want to have part of the Python script that calls the Oauth endpoint as well and leverage the code to recall the Oauth endpoint if the token expires. Otherwise I would look into doing the API call using tools in the workflow built into an iterative macro instead and not using Python. 

Labels