Giter Site home page Giter Site logo

pyryx's Introduction

PyRyx

Python + Alteryx

PyRyx is a Python client helper for working with the Alteryx Gallery API.

It includes functions which allow a user to easily use Alteryx Applications as data processing APIs, piping in data and retrieving the results.

Usage

from PyRyx import pyryx
client_key = 'your_client_key_here'
client_secret = 'your_client_secret_here'
gallery_url = 'http://localhost:80/gallery/api/v1/'
ayx = pyryx.PyRyxApi(client_key, client_secret, gallery_url)
ayx.getSubscriptionWorkflows()
[{'fileName': 'Tableau WDC Demo.yxwz',
  'id': '57acaca4065e3f26a82b2615',
  'isChained': False,
  'metaInfo': {'author': '',
   'copyright': '',
   'description': '#tableauwdc',
   'name': 'Tableau WDC Demo',
   'noOutputFilesMessage': '',
   'outputMessage': '',
   'url': '',
   'urlText': ''},
  'packageType': 0,
  'public': False,
  'runCount': 0,
  'runDisabled': False,
  'subscriptionId': '503bac188031af11f8f8e478',
  'uploadDate': '2016-08-11T16:49:40.732Z',
  'version': 1},
 {'fileName': 'Tableau WDC Demo 52.yxwz',
  'id': '57d71458065e3f31e07d96a0',
  'isChained': False,
  'metaInfo': {'author': '',
   'copyright': '',
   'description': '#tableauwdc',
   'name': 'Tableau WDC Demo 52',
   'noOutputFilesMessage': '',
   'outputMessage': '',
   'url': '',
   'urlText': ''},
  'packageType': 0,
  'public': False,
  'runCount': 0,
  'runDisabled': False,
  'subscriptionId': '503bac188031af11f8f8e478',
  'uploadDate': '2016-09-12T20:47:20.414Z',
  'version': 1}]
ayx.getWorkflowQuestions('57acaca4065e3f26a82b2615')
[{'description': 'Select Region',
  'items': [{'key': 'East', 'value': 'East'},
   {'key': 'West', 'value': 'West'}],
  'multiple': 'False',
  'name': 'Select Region',
  'type': 'QuestionListBox'},
 {'description': 'Orders on or after...',
  'name': 'Orders on or after',
  'type': 'QuestionDate'}]
questions_list = ayx.getWorkflowQuestions('57acaca4065e3f26a82b2615')

questions = [{ "name": question['name']} for question in questions_list]

questions[0]['value'] = 'East'    

questions[1]['value'] = '2016-07-10'

question_param = { "questions" : questions }
ayx.executeAndFetchResults('57acaca4065e3f26a82b2615', question_param)
Running
Completed
Date Margin RecordID Region Sales State
0 2016-10-17 17804.6 35 East 30197.6 Alabama
1 2016-08-25 3067.71 104 East 28119.2 Alabama
2 2016-10-02 18371.8 194 East 24885 Alabama
3 2016-10-17 7107.53 249 East 12340.5 Alabama
4 2016-10-08 3599.09 282 East 28586 Alabama
5 2016-09-22 1063.48 303 East 32159.7 Alabama
6 2016-09-10 11311.4 365 East 17891.7 Alabama
7 2016-07-24 7369.75 413 East 24912.2 Alabama
8 2016-09-22 3942.1 448 East 34925.2 Alabama
9 2016-09-09 9349.83 456 East 15435.2 Alabama
10 2016-09-28 6813.12 457 East 14590.9 Alabama
11 2016-07-23 16332.3 541 East 18840.4 Alabama
12 2016-07-11 14735.8 576 East 22774.7 Alabama
13 2016-08-04 29911.7 588 East 36416.6 Alabama
14 2016-08-31 1895.27 614 East 8063.33 Alabama
15 2016-08-30 492.692 628 East 2791.9 Alabama
16 2016-08-08 9788.15 695 East 48614.7 Alabama
17 2016-07-12 27843.5 736 East 29228.1 Alabama
18 2016-09-10 10755.4 755 East 15478.7 Alabama
19 2016-10-09 12843.1 774 East 23501.7 Alabama
20 2016-09-28 2228.32 780 East 36082.4 Alabama
21 2016-09-24 9840.11 789 East 18550.5 Alabama
22 2016-08-23 3420.85 1119 East 8035.69 Alabama
23 2016-09-21 2383.95 1135 East 10437.5 Alabama
24 2016-08-26 7149.62 1187 East 13409.9 Alabama
25 2016-08-25 10939.4 1279 East 18808.5 Alabama
26 2016-08-06 13363.7 1323 East 48917.8 Alabama
27 2016-10-15 22499.8 1359 East 37306.4 Alabama
28 2016-09-08 4982.07 1367 East 5659.37 Alabama
29 2016-10-15 3073.99 1375 East 6763.26 Alabama
... ... ... ... ... ... ...
1068 2016-07-11 24054.2 714 East 49648.7 Wisconsin
1069 2016-08-17 9394.66 725 East 40781.5 Wisconsin
1070 2016-10-03 19196.7 739 East 43374.1 Wisconsin
1071 2016-07-21 2005.85 759 East 31003.8 Wisconsin
1072 2016-09-09 5867.29 767 East 8745.1 Wisconsin
1073 2016-08-28 14032.7 793 East 46950.7 Wisconsin
1074 2016-09-06 18265.6 819 East 28421.7 Wisconsin
1075 2016-08-14 4329.21 865 East 34188.6 Wisconsin
1076 2016-09-29 4615.7 913 East 17847.3 Wisconsin
1077 2016-10-05 432.833 949 East 23058.7 Wisconsin
1078 2016-09-26 12082.3 1022 East 19670 Wisconsin
1079 2016-10-18 5043.43 1148 East 36855.9 Wisconsin
1080 2016-08-27 1007.93 1195 East 8300.48 Wisconsin
1081 2016-07-18 40058.5 1233 East 42945.8 Wisconsin
1082 2016-09-22 19342 1297 East 43092.9 Wisconsin
1083 2016-09-11 34852.9 1417 East 46387.8 Wisconsin
1084 2016-07-27 3039.1 1426 East 3915.7 Wisconsin
1085 2016-07-31 -128.106 1442 East 15710.8 Wisconsin
1086 2016-09-08 2075.26 1571 East 49849.5 Wisconsin
1087 2016-09-27 22062.4 1670 East 24968.3 Wisconsin
1088 2016-07-30 2126.33 1684 East 29597.6 Wisconsin
1089 2016-10-05 33385.3 1691 East 34251 Wisconsin
1090 2016-09-17 2038.66 1779 East 2969.3 Wisconsin
1091 2016-10-14 2213.55 1781 East 11631.7 Wisconsin
1092 2016-07-26 18308.7 1795 East 30394.5 Wisconsin
1093 2016-07-15 5041.6 1810 East 13318.9 Wisconsin
1094 2016-09-30 17063.2 1882 East 35135.4 Wisconsin
1095 2016-07-15 1990.32 1910 East 4927.32 Wisconsin
1096 2016-09-27 32378.4 1947 East 42106.2 Wisconsin
1097 2016-08-02 35421.7 1965 East 49226.6 Wisconsin

1098 rows ร— 6 columns

pyryx's People

Contributors

johnkabler avatar camzbarber avatar

Stargazers

 avatar Amber Rivera avatar  avatar Timothy Dobbins avatar Jordi avatar Joshua Burkhow avatar Rithi avatar

Watchers

James Cloos avatar

pyryx's Issues

Add ability to use without pandas

I'm using this as a backend service and pandas just gets in the way. It'd be nice to allow the user to turn off pandas integration.

I'd even go so far as to say pandas should be decoupled from this library and leave that option up to the user since pandas isn't doing any heavy lifting here; just one pd.read_csv call and a pd.concat call, both of which can be done with native python.

Great library though! Saving me some time for sure.

Instead of returning IndexError when outputs is an empty list, return the empty list

Great library. Thanks for creating it.

When I run

ayx.fetchJobOutput(job_id)

I get:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-93-1e08c146b922> in <module>()
----> 1 ayx.fetchJobOutput(job_id)

<ipython-input-4-7e873ebaa93a> in fetchJobOutput(self, job_id)
     64             df = pd.concat(result_list)
     65         else:
---> 66             df = result_list[0]
     67         return df[:-1]
     68 

IndexError: list index out of range

if the result of ayx.checkJobState(job_id)['outputs'] is an empty list.

Instead of throwing an error, it'd be more intuitive to return the empty list, I think.

SSLError

Hi @johnkabler,

I tried using the below approach asper your PyRyx code: (idea is to try just one component first: get workflows in subscription)

client_key = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
client_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
gallery_url = "https://name.corp.company.com:443/gallery/api/v1/workflows/subscription/"

queryoauth = OAuth1(client_key, client_secret, signature_type='query')

requests.get(gallery_url, auth=queryoauth)

I get the following error:
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)

I am able to use the api on the portal (/gallery/api-docs/#!/workflows.json/GetStudioAppsGET)
but when i try using python from my machine, i see the above error.

We have installed alteryx in a VM in Azure and I'm trying to run the python code on my machine while connected to the company network.

Can you please help?

Thanks,
Srikanth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.