python-wordpress-xmlrpc
python-wordpress-xmlrpc copied to clipboard
i have problem in adding new cookies for xmlrpc.client in Python 3
i tried this from https://stackoverflow.com/questions/25876503/how-to-retain-cookies-for-xmlrpc-client-in-python-3
class CookiesTransport(xmlrpc.client.Transport): """A Transport subclass that retains cookies over its lifetime."""
def __init__(self):
super().__init__()
self._cookies = []
def send_headers(self, connection, headers):
if self._cookies:
connection.putheader("Cookie", "; ".join(self._cookies))
super().send_headers(connection, headers)
def parse_response(self, response):
for header in response.msg.get_all("Set-Cookie"):
cookie = header.split(";", 1)[0]
self._cookies.append(cookie)
return super().parse_response(response)
proxy = xmlrpc.client.ServerProxy(URL, CookiesTransport())
but not worked is there any way to add new cookie in the client request