Your code looks just fine.
You might not know this, but most XML-RPC endpoints (such as Last.fm's) support XML-RPC introspection. For instance, if you want to find out what methods it exposes, do this:
import xmlrpclib
svc = xmlrpclib.ServerProxy('http://ws.audioscrobbler.com/2.0/')
print svc.system.listMethods()
And you'll be given a list of the methods exposed by the XML-RPC endpoint.
By the way, that bit of code up there demonstrates how to use a ServerProxy
object to call a method exposed by the endpoint it's tied to, in this case, the system.listMethods
method. If you wanted to call the user.getTopTags
(as demonstrated on the API documentation homepage) method exposed by Last.fm, you'd do this:
print svc.user.getTopTags({'user': 'foo', 'api_key': 'bar'})
Dead simple! Of course, you'll need an API key from Last.fm before you can use the API.