[Twisted-Python] creds and xmlrpc

Justin Johnson justinjohnson at fastmail.fm
Wed Jun 4 11:44:35 EDT 2003

I currently have a really simple xmlrpc service defined.  I'd like to add
some authorization to the service so users must enter a user id and
password to use the service.  Can this be done with creds?  Anybody have
any code snippets that would fit the service defined below (most code is
snipped out).  I read the HOWTO, but wasn't sure how to make things work
with what I'm doing.

from vob import VOB
import config
import os
from twisted.web import xmlrpc, server

class CCService(xmlrpc.XMLRPC):
	"""Service for handling remote VOB creation, removal, and general
	   ClearCase maintenance.

	def xmlrpc_mkvob(self, vobs, group):
		"""Create VOBs and apply standard triggers.
		results = ""
		for tag in vobs:
			log("Start mkvob for VOB '%s'" % tag)
			vob = VOB(tag, group)
			results += vob.make()
			results += vob.applyTriggers()
			log("End mkvob for VOB '%s'" % tag)
		return results


def main():
	from twisted.internet.app import Application
	app = Application("ccservice")
	resource = CCService()
	app.listenTCP(config.portNumber, server.Site(resource))
	return app

application = main()

if __name__ == '__main__':

Thanks much.

More information about the Twisted-Python mailing list