Forum Discussion
Brian_69413
Nimbostratus
Mar 19, 2010iControl with Python not authenticating
I am having trouble with getting my python modules to work correctly. I display the below to show that I have the proper packages installed:
>>> import suds
>>> suds.__version__
'0.3.8'
>>> suds.__build__
'GA R627-20091217'
>>> import pycontrol.pycontrol as pc
>>> pc.__version__
'2.0'
>>> pc.__build__
'r76'
>>>
I can browse to https://admin:admin@1.1.1.1/iControl/iControlPortal.cgi and it logs in fine. However when I try using python directly, I get an error:
>>> b = pc.BIGIP(hostname = '1.1.1.1', username = 'admin', password = 'admin', fromurl = True, wsdls = ['LocalLB.Pool']) Traceback (most recent call last):
File "", line 1, in ?
File "build/bdist.linux-i686/egg/pycontrol/pycontrol.py", line 79, in __init__
File "build/bdist.linux-i686/egg/pycontrol/pycontrol.py", line 99, in _get_clients
File "build/bdist.linux-i686/egg/pycontrol/pycontrol.py", line 151, in _get_suds_client
File "build/bdist.linux-i686/egg/suds/client.py", line 109, in __init__
File "build/bdist.linux-i686/egg/suds/wsdl.py", line 172, in __init__
File "build/bdist.linux-i686/egg/suds/sax/parser.py", line 133, in parse
File "build/bdist.linux-i686/egg/suds/transport/https.py", line 69, in open
File "build/bdist.linux-i686/egg/suds/transport/http.py", line 72, in open
suds.transport.TransportError: HTTP Error 401: F5 Authorization Required
>>>
Does anyone have any ideas what I am missing here? I can see this in the LTM logs:
info logger: [ssl_req][19/Mar/2010:15:38:41 -0400] 172.19.121.8 TLSv1 DHE-RSA-AES256-SHA "GET /iControl/iControlPortal.cgi?WSDL=LocalLB.Pool HTTP/1.1" 1755
info logger: [ssl_acc] 172.19.121.8 - - [19/Mar/2010:15:38:41 -0400] "GET /iControl/iControlPortal.cgi?WSDL=LocalLB.Pool HTTP/1.1" 401 1755
- L4L7_53191
Nimbostratus
Weird. What python version are you using? Also, could you try pulling down a test WSDL and using the directory='/path/to/your/wsdl' keyword argument? This is literally the first time I've run into this error since very early on when I was working out the transport options with suds and https:// versus file:// URL access, so this is an odd one for sure. - Brian_69413
Nimbostratus
I am currently running Python 2.4.2.
I am not sure I understand the directory="" option. Is that a path on the LB or a path on the server running the python code?
- L4L7_53191
Nimbostratus
It's the fully qualified path to a WSDL that you've stored on local disk. - L4L7_53191
Nimbostratus
Brian: fwiw, I just tested this with python 2.4 to be sure. I ran into a bizarre ulrlib2 issue, so I upgraded to 2.4.4 and it's working now (on my windows laptop):
The only difference is that I'm using an ultra-new version of pycontrol on Suds 0.3.9 for some testing before I release 2.1.Python 2.4.4 (71, Oct 18 2006, 08:34:43) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import pycontrol.pycontrol as pc >>> b = pc.BIGIP(hostname='10.100.100.245',username='admin',password='admin',fro murl=True,wsdls=['LocalLB.Pool']) >>> b.LocalLB.Pool.get_list() [P_1, P_2, P_3, P_4, P_5, P_6, T_1, T_10, T_100, T_11, T_12, T_13, T_14, T_15, T _16, T_17, T_18, T_19, T_2, T_20, T_21, T_22, T_23, T_24, T_25, T_26, T_27, dummyServer, xmlrpc-pool]
- Brian_69413
Nimbostratus
An upgrade to Python version 2.5.2 fixed my issues. Thanks for the help! - L4L7_53191
Nimbostratus
Great news. I've heard about urllib2 issues with earlier 2.4 releases, and your post proved that out!
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects