<!-- my kingdom for the necessary fu to make
rdflib read N3 files... -->
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="x-urn:asc:w5#">
<service rdf:about="http://www.foobar.com/xml/">
<protocol rdf:resource = "http://xmlrpc.com/" />
<login>hello word</login>
<filter><![CDATA[ ... ]]></filter>
<dc:title>Foo Bar Pictures</dc:title>
</service>
<service rdf:about="http://www.barfoo.net/xml/">
<protocol rdf:resource = "http://xmlrpc.com/" />
</service>
<protocol rdf:about="http://xmlrpc.com/">
<dc:title>XML-RPC</dc:title>
</protocol>
</rdf:RDF>
And then...
#!/usr/local/bin/python
from rdflib.Namespace import Namespace
from random import choice
from xmlrpclib import Server
from rConfig import rConfig
w5 = Namespace("x-urn:asc:w5#")
cfg = rConfig()
cfg.Load("/path/to/config.xml")
# insert idle speculation about the ability
# to overload an object's stringify method
# in python...
service = choice(cfg.ListServices(["http://www.xmlrpc.com/"]))
attrs = cfg.DescribeService(service)
# this actually yields empty values but
# you get the idea — insert hand-waving
# about potentially non-existent keys here.
# maybe add some kind of helper method...
args = {"login" : attrs[ w5["login"] ],
"filter" : attrs[ w5["filter"] ]}
server = Server(service)
response = server.w5.RandomImage(args)
Please remember that this is still a (slow) moving target.
<!-- my kingdom for the necessary fu to make rdflib read N3 files... --> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="x-urn:asc:w5#"> <service rdf:about="http://www.foobar.com/xml/"> <protocol rdf:resource = "http://xmlrpc.com/" /> <login>hello word</login> <filter><![CDATA[ ... ]]></filter> <dc:title>Foo Bar Pictures</dc:title> </service> <service rdf:about="http://www.barfoo.net/xml/"> <protocol rdf:resource = "http://xmlrpc.com/" /> </service> <protocol rdf:about="http://xmlrpc.com/"> <dc:title>XML-RPC</dc:title> </protocol> </rdf:RDF>And then...
#!/usr/local/bin/python from rdflib.Namespace import Namespace from random import choice from xmlrpclib import Server from rConfig import rConfig w5 = Namespace("x-urn:asc:w5#") cfg = rConfig() cfg.Load("/path/to/config.xml") # insert idle speculation about the ability # to overload an object's stringify method # in python... service = choice(cfg.ListServices(["http://www.xmlrpc.com/"])) attrs = cfg.DescribeService(service) # this actually yields empty values but # you get the idea — insert hand-waving # about potentially non-existent keys here. # maybe add some kind of helper method... args = {"login" : attrs[ w5["login"] ], "filter" : attrs[ w5["filter"] ]} server = Server(service) response = server.w5.RandomImage(args)Please remember that this is still a (slow) moving target.