DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Python (http://www.daniweb.com/forums/forum114.html)
-   -   Auth Object (http://www.daniweb.com/forums/thread159414.html)

adam291086 Nov 25th, 2008 9:00 am
Auth Object
 
Some languages like C# create an Auth object to authenticate themselves on a soap server.

for example
  cpLatestBrief.authValue = new auth();
      cpLatestBrief.authValue.username = "username"; // your aql username
      cpLatestBrief.authValue.password = "password"; // your aql password

how can you do this with python?

jlm699 Nov 25th, 2008 10:44 am
Re: Auth Object
 
Look into SOAPpy.

adam291086 Nov 25th, 2008 10:48 am
Re: Auth Object
 
i am using SOAPpy but have no idea how to do the auth object. I have tried doing

from SOAPpy import WSDL
print "Content-type: text/html\n"
wsdlFile = 'http://gw1.aql.com/soap/sendservice.php?WSDL'
HTTPTransport.setAuthentication('username','password')
server = WSDL.Proxy(wsdlFile, transport=HTTPTransport)
print server.ApiVersion()

and i get nothing. From the company i am trying to connect to they are saying there is authentication errors

jlm699 Nov 25th, 2008 10:56 am
Re: Auth Object
 
I've never used SOAPpy myself, but there's a chapter about it in my favorite Python learning book: Dive Into Python Chapter 11

adam291086 Nov 26th, 2008 4:34 am
Re: Auth Object
 
i have been using that tutorial, but it's aimed at using google. The authentication happens by using an API key. I need to use and Auth object.

If i do something like
from SOAPpy import WSDL       
wsdlFile = 'http://gw1.aql.com/soap/sendservice.php?WSDL'
server = WSDL.Proxy(wsdlFile)   
print server.methods.keys()
all the method keys are printed out but as soon as i put in some http authentication nothing is displayed

wsdlFile = 'http://gw1.aql.com/soap/sendservice.php?WSDL'
HTTPTransport.setAuthentication('adamplowman','AdAMicMAN')
server = WSDL.Proxy(wsdlFile, transport=HTTPTransport)
print server.methods.keys()
Anymore ideas?


All times are GMT -4. The time now is 5:42 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC