This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Now that it's live, don't forget to accept your certification badge on Credly today! Learn more here.
We are currently experiencing an issue with Email verification at this time and working towards a solution. Should you encounter this issue, please click on the "Send Verification Button" a second time and the request should go through. If the issue still persists for you, please email firstname.lastname@example.org for assistance.
I am working to pull data from an API using Python in Alteryx. I have copied the JSONRPC package from python on my local computer to the site packages in Alteryx's location "C:\Program Files\Alteryx\bin\Miniconda3\Lib\site-packages". When I try to execute the command "from jsonrpclib import jsonrpc" I get the following error "ImportError: cannot import name 'Transport' "
I am able to run the python script fully in the python application under the Miniconda3 subdirectory, so I am not sure why it will not work in Alteryx designer.
Screenshots below and I blocked off parts of the python code for company privacy.
I have removed/uninstalled the packages I copied into Alteryx Site Packages, and then installed them using the following command "Package.installPackages(['jsonrpc','jsonrpclib','impacket','jsonrpc_requests','jsonrpcclient','jsonschema','pprint'])"
When I ran "from jsonrpclib import jsonrpc", I received "No module named 'xmlrpclib'". Xmlrpclibwould not install from packages, so I downloaded it from here (http://effbot.org/downloads/#xmlrpclib) and placed it into the site packages location. When I ran it again, I still get the error "cannot import name 'Transport'
In Python 3 xmlrpclib was renamed xmlrpc.client, so you need to fix the imports by changing xmlrpclib to xmlrpc.client.
from xmlrpc.client import Transport as XMLTransport from xmlrpc.client import SafeTransport as XMLSafeTransport from xmlrpc.client import ServerProxy as XMLServerProxy from xmlrpc.client import _Method as XML_Method
Slowly getting there. I renamed xmlrpclib to xmlrpc.client, then got "No module named 'httplib'. I had to change httplib to http.client. I then got the error "Cannot import name 'HTTP'". I saw the line that had "from httplib import HTTP, HTTPConnection" and I removed "HTTP," and it worked to run the original code "from jsonrpclib import jsonrpc".
Now I am trying to call the host using jsonrpc.ServerProxy("host:port") and I get "Attribute Error module 'urllib' has no attribute 'splittype'". So far, I have tried changing urllib to urllib.request, urllib to urllib3.request, and urllib3, but it still gave me the same error. I also tried to add import urllib.parse and change the splittype line to urllib.parse and no luck.
And another update. I used a web 2to3 python converter for the jsonrpc file, and added in the line "from urllib.parse import (splittype, splithost)" in the jsonrpc package.
Next, when calling the host, i changed it from "jsonrpc.serverproxy" to "jsonrpc.xmlserverproxy" and that worked. Now i am on the last line to call the API and I get "xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0". I am only setting response equal to the report I am looking for with the proper parameters, so I am trying to figure this out!
After a few issues with Alteryx saying jupyter notebook could not load, re-installs, and a final uninstall and reinstall, I was able to get python working again. I received some tips from stack overflow here
that suggested I use jsonrpclib-pelix instead of jsonrpclib because it was supported on python 2, but not 3. Everything works now!