Kill the XMLRPC transport

it looks unused.
This commit is contained in:
David Douard 2018-12-12 18:25:25 +01:00
parent ffe4ac9a3c
commit 532fe90df5

View file

@ -7,7 +7,6 @@ import random
from datetime import datetime
from email.utils import parsedate
from pprint import pformat
from xmlrpc import client
import requests
import xmltodict
@ -21,62 +20,6 @@ from .abstractattribute import AbstractAttribute
from .lister_base import FetchError
class ListerXMLRPCTransport(abc.ABC):
"""Use the xmlrpc library for making Lister endpoint requests.
To be used in conjunction with SWHListerBase or a subclass of it.
"""
SERVER = AbstractAttribute('string containing the server to contact for '
'information')
def __init__(self):
self.lister_version = __version__
def get_client(self, path):
"""Initialize client to query for result
"""
return client.ServerProxy(path)
def request_uri(self, _):
"""Same uri called once
"""
return self.SERVER
def request_params(self, identifier):
"""Cannot pass any parameters to query to the xmlrpc client so cannot
even pass our user-agent specifics.
"""
return {}
def transport_quota_check(self, response):
"""No rate limit dealing explained.
"""
return False, 0
def transport_request(self, identifier):
"""Implements SWHListerBase.transport_request
"""
path = self.request_uri(identifier)
try:
return self.get_client(path)
except Exception as e:
raise FetchError(e)
def transport_response_to_string(self, response):
"""Implements SWHListerBase.transport_response_to_string for XMLRPC
given responses.
"""
s = pformat(self.SERVER)
s += '\n#\n' + pformat(response) # Note: will potentially be big
return s
class SWHListerHttpTransport(abc.ABC):
"""Use the Requests library for making Lister endpoint requests.