community
cancel
Showing results for 
Search instead for 
Did you mean: 

Dev Space

Customize & extend the power of Alteryx. SDKs, APIs, custom tools, and more!

Python library for Alteryx Gallery API

Our team has just published an accessible and easy to use Python library to connect to the Alteryx Gallery API.

 

Check it out at: 

 

https://github.com/Theamazingdp/AlteryxGalleryAPI

 

 

 

Authored by David Pryor and Co-Authored by Nick Simmons and Ritu Gowlikar

Alteryx
Alteryx

This is great!  I've got one of these as well, from a couple of years ago:

https://github.com/johnkabler/PyRyx

 

I'd love to contribute to this, since mine was more tailored for working with pandas dataframes.  

JP Kabler
Software Engineer, Emerging Capabilities
Alteryx
Asteroid

@nick_simmons - Thank you!

 

I was looking for a simplier solution to Visual Studio, and this was it. I simply wrapped your excellent work into a small command line interface that I am able to call from another application.

 

If you're interested, check out my changes here:

 

https://github.com/daqieq/AlteryxGalleryAPI

 

N.B. - For others looking for something like this ... my code is raw, offered 'as is' with no warranty ... ;) and requires additional coding to be complete and ready for production usage.

Asteroid

All,

 

After a brief message to @c2willis he suggested I bring the questions to the community.

 

I pulled down his cli python program, got my python working to run the program ayx-cli.py.  Probably some simple questions but hopefully someone can be kind enough to steer me in the right direction.

 

I run the program as: python ayx-cli.py -s "https://alteryx.<mydomain>.com/" "myserverkey" "secretkey"

 

I get the error back as:

usage: ayx-cli.py [-h] (-s S | -t T) [-a A] [-v] server key secret
ayx-cli.py: error: the following arguments are required: secret

 

Seems to me -s is to submit the job giving it three parameters "server name", "server key", and "secret key"  but maybe I'm missing it.

 

I believe I understand the api but just need to figure out the cli program a bit more.

 

Thanks,

Jeff

 

 

Sorry for the radio silence, haven't checked this in a while.

 

@c2willis - This is awesome work! Thank you for contributing. 

 

@JKPa - PyRyx looks awesome. Any collaboration would be welcome!

 

 

Asteroid

Looking at it further... using -s parameter requires the application id so I added that.  Now because I'm connecting with https I believe I'm getting an error (maybe about wrong port?).  Can server be "https://alteryx.mydomain.com/"?

 

In code I changed it in one spot to https  but get the following error(s):

C:\Users\vandeje1\Documents\Python_Scripts>python ayx-cli.py -s "appid" "https://alteryx.<mydomain>.com/" "key1" "key2"
HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //alteryx.mydomain.com//gallery/api/v1/workflows/subscription/?oauth_consumer_key=key1&oauth_nonce=g6X9I&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1545103686&oauth_version=1.0&search=key2&oauth_signature=u4PXf2%2Bw6q1MC9KjfKbqqirsrtY%3D (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x000002A0CCAD3E48>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

 

Thanks,

Jeff

Asteroid

Hi @jeffv

 

Don't pass the https:// in the command line. If you look at line 31 of my ayx-cli.py file, it prepends the http:// to complete the URL. If you want to use https, change it on line 31.

 

Your call to the cli should be something like this:

 

python ayx-cli.py alteryx.<mydomain>.com key1 key2 -s appid
Asteroid

Hi,

 

I tried above approach but I receive the following.

 

python ayx-cli.py alteryx.myngc.com key1 key2 -s appid
HTTPSConnectionPool(host='alteryx.mydomain.com', port=443): Max retries exceeded with url: /gallery/api/v1/workflows/subscription/?oauth_consumer_key=key1&oauth_nonce=Jn5Sw&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1545202254&oauth_version=1.0&search=appid&oauth_signature=0t6XLsLdNk%2FVtdtn7VYT6U4oBqQ%3D (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')])")))
HTTPSConnectionPool(host='alteryx.myngc.com', port=443): Max retries exceeded with url: /gallery/api/v1/workflows/subscription/?oauth_consumer_key=key1&oauth_nonce=Jn5Sw&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1545202254&oauth_version=1.0&search=appid&oauth_signature=0t6XLsLdNk%2FVtdtn7VYT6U4oBqQ%3D (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')])")))

 

any thoughts?  I'm a bit lost....

 

Thanks,

Jeff

Asteroid

Reaching out again...

 

Should the -s parameter be followed with an AppID such as 5c1bb17739745f1db459ccf9 or should it have the application name?

 

Either way I still get an error:

(Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')])")))

 

Running through the gallery testing of api it seems to work but the python cli seems to fail with above error.  Likely my misunderstanding but can't seem to get past it.

 

Anybody able to shed some light?

Jeff

Asteroid

Hi @jeffv

 

Are you using https? My server installation doesn't work with https which is why I used http. Check this by typing https:// infront of your normal url for the web based API testing page:

 

https://<servername>/gallery/api-docs/

 

If that doesn't work, then replace https with http in the ayx-cli.py file.

If it does work, then check the port that your server is using. The error message shows port 443 (?) so just make sure that your Alteryx Server is configured to use that port.

I would make friends with the colleagues that are maintaining the server! They will be your best friend here.

 

The -s (search) parameter functions the same as the search parameter on the API interactive documentation web page. You can search for a workflow name, but my experience is that using the app id works best.