Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import xmlrpclib
>>> server =
xmlrpclib.Server("http://david....@gmail.com:x...@www.meetingmon
key.net/init/default/call/xmlrpc")
>>> server2 =
xmlrpclib.Server("http://david....@gmail.com:xx...@127.0.0.1:800
0/mm_beta_1/default/call/xmlrpc")
>>> server.getmeetings()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python26\lib\xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "C:\Python26\lib\xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "C:\Python26\lib\xmlrpclib.py", line 1243, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for
david....@gmail.com:xx...@www.meet
ingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER>
>>> server2.getmeetings()
'you are logged in!'
Do I need to enables something special in the environment other than
auth.settings.allow_basic_login = True, which is already set. Alos, is this
a recommended way of passing credentials to a web2py services, it seems as
if they may be exposed in the clear during transport???
/david
Even more confusion. I can get it to work on dev environment by reverting
to the original decorator on call
#...@auth.requires(auth.user)
@auth.requires_login()
def call():
"""
exposes services. for example:
http://..../[app]/default/call/jsonrpc
decorate with @services.jsonrpc the functions to expose
supports xml, json, xmlrpc, jsonrpc, amfrpc, rss, csv
"""
session.forget()
return service()
This works on the local/dev machine. By work I meant i get the expected result when valid credentials are passed, and a 303 when invalid is passed!!! I cannot get it to work on the production system. If I comment out the authorization decorator all together the service is invoked thereby isolating the problem to the way the credentials are passed/handled. The code is Identical so it must be something in the environmental setup. Any ideas?
auth.settings.allow_basic_login = True
and the default/call function is decorated to require login.
The app behaves correctly when running on my local machine, but always
returns 303 when invoked on the production server.
The webfaction server is Linux based and uses Apache as the web server.
Additionally, below are the commands I used to test via a python console:
--------------------------------------
The original app (from which the test was derived)
import xmlrpclib
rserver =
xmlrpclib.Server("http://david....@gmail.com:xx...@www.meetingmonkey.net/i
nit/default/call/xmlrpc")
rserver.getmeetings()
lserver =
xmlrpclib.Server("http://david....@gmail.com:xx...@127.0.0.1:8000/mm_beta_
1/default/call/xmlrpc")
lserver.getmeetings()
------------------------------------
The test app I sent last evening
tserver =
xmlrpclib.Server("http://david....@gmail.com:xx...@127.0.0.1:8000/svctest/
default/call/xmlrpc")
tserver.getmeetings()
rserver =
xmlrpclib.Server("http://david....@gmail.com:xx...@www.meetingmonkey.net/w
elcome/default/call/xmlrpc")
rserver.getmeetings()
Last login: Mon Nov 1 05:46:43 on ttys000
pydlw-mac-laptop:~ David$ python
Python 2.5 (r25:51918, Sep 19 2006, 08:49:13)
[GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import urlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named urlib
>>> import urllib
>>> import xmlrpclib
>>> rserver = xmlrpclib.Server("http://david....@gmail.com:xx...@www.meetingmonkey.net/init/default/call/xmlrpc")
>>> rserver.getmeetings()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1191, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for david....@gmail.com:xx...@www.meetingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER>
>>> rserver = xmlrpclib.Server(urllib.quote("http://david....@gmail.com:xx...@www.meetingmonkey.net/init/default/call/xmlrpc"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1411, in __init__
raise IOError, "unsupported XML-RPC protocol"
IOError: unsupported XML-RPC protocol
>>> rserver = xmlrpclib.Server("http://"+urllib.quote("david....@gmail.com:xxx")+"@www.meetingmonkey.net/init/default/call/xmlrpc")
>>> rserver.getmeetings()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1191, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for david.waldrop%40gmail.com%3A...@www.meetingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER>
>>> rserver = xmlrpclib.Server("http://"+urllib.quote("david....@gmail.com:xx@x")+"www.meetingmonkey.net/init/default/call/xmlrpc")
>>> rserver.getmeetings()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1191, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for david.waldrop%40gmail.com%3Axx%40xwww.meetingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER>
>>> rserver = xmlrpclib.Server("http://%s:%s...@www.meetingmonkey.net/init/default/call/xmlrpc" % (urllib.quote("david....@gmail.com"),urllib.quote("xxx")))
>>> rserver.getmeetings()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1147, in __call__
return self.__send(self.__name, args)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1437, in __request
verbose=self.__verbose
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/xmlrpclib.py", line 1191, in request
headers
xmlrpclib.ProtocolError: <ProtocolError for david.waldrop%40gmail.com:xx...@www.meetingmonkey.net/init/default/call/xmlrpc: 303 SEE OTHER>