casimirian: (Default)
casimirian ([personal profile] casimirian) wrote in [site community profile] dw_dev2018-01-01 06:19 pm
Entry tags:

XMLRPG?

Was there a reason GET is disabled for https://www.dreamwidth.org/interface/xmlrpc?
lithiumdoll: (Default)

[personal profile] lithiumdoll 2018-07-15 11:52 am (UTC)(link)
Kind of a "from the mists of time" thing, but just in case anyone else using the lj lib at https://github.com/daniilr/python-lj finds this:

For DW, just subclass LJServer and create DWTransport to use xmlrpclib.SafeTransport instead of xmlrpclib.Transport. (Or don't bother and just straight use xmlrpclib.SafeTransport, sure, whatever:P)

try:
    import xmlrpc.client as xmlrpclib
except ImportError:
    import xmlrpclib
try:
    import urllib.request as urllib2
except ImportError:
    import urllib2


from lj import lj


class DWTransport(xmlrpclib.SafeTransport):
    pass


class DWServer(lj.LJServer):
    def __init__(self, clientversion, user_agent, host='https://www.dreamwidth.org/'):
        super().__init__(clientversion, user_agent, host)
        transport = DWTransport()
        transport.user_agent = user_agent
        self.server = xmlrpclib.ServerProxy(host + 'interface/xmlrpc', transport)

dreamwidth = DWServer("Python-Blog3/1.0", "http://yoursite.com; your@email.com")
dreamwidth.login(username, password)
response = dreamwidth.postevent(subject, message)
Edited 2018-07-15 11:55 (UTC)
lithiumdoll: (Default)

[personal profile] lithiumdoll 2018-07-16 06:55 am (UTC)(link)
Oh cool - I’m glad it was helpful! Thank you for raising this in the first place so I had somewhere to start :D