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
no subject
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)
no subject
no subject