示例#1
0
def test_wsdl_retriever_wsdl(mock_taverna_parser, mock_webservice_parser,
                             mock_link_test):
    """
    Unable to find any valid Taverna URLs? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
示例#2
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.votable_interceptor = VotableInterceptor()
        self.hec_client = C(link,
                            plugins=[self.votable_interceptor],
                            transport=WellBehavedHttpTransport())
示例#3
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()
        # Disable SSL check.
        session = Session()
        session.verify = False
        transport = Transport(session=session)
        self.hec_client = Client(link, transport=transport)
示例#4
0
文件: hec.py 项目: Rapternmn/sunpy
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link: str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> hc = hec.HECClient()
        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.votable_interceptor = VotableInterceptor()
        self.hec_client = C(link, plugins=[self.votable_interceptor], transport=WellBehavedHttpTransport())
示例#5
0
文件: hec.py 项目: vatch123/sunpy
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.hec_client = zeep.Client(link)
示例#6
0
文件: hec.py 项目: Cadair/sunpy
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA

        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()

        self.hec_client = zeep.Client(link)
示例#7
0
    def __init__(self, link=None):
        """
        The constructor; establishes the webservice link for the client

        Initializes the client with a weblink

        Parameters
        ----------
        link : str
            Contains URL to valid WSDL endpoint

        Examples
        --------
        >>> from sunpy.net.helio import hec
        >>> hc = hec.HECClient()  # doctest: +REMOTE_DATA
        """
        if link is None:
            # The default wsdl file
            link = parser.wsdl_retriever()
        session = Session()
        # This is for use in our test suite.
        session.verify = not (bool(os.environ.get("NO_VERIFY_HELIO_SSL", 0)))
        transport = Transport(session=session)
        self.hec_client = Client(link, transport=transport)
示例#8
0
def test_wsdl_retriever_get_link(mock_link_test, mock_taverna_parser, mock_webservice_parser):
    """
    Get a Taverna link
    """
    assert wsdl_retriever() == 'http://www.helio.uk/Taverna/hec?wsdl'
示例#9
0
Access the Helio Event Catalogue
"""
from sunpy.net.proxyfix import WellBehavedHttpTransport
from sunpy.net.helio import parser
from sunpy.time import time as T
from suds.client import Client as C
from astropy.io.votable.table import parse_single_table
import io

__author__ = "Michael Malocha"
__version__ = "September 22nd, 2013"

__all__ = ["HECClient"]

# The default wsdl file
DEFAULT_LINK = parser.wsdl_retriever()


def suds_unwrapper(wrapped_data):
    """
    Removes suds wrapping from returned xml data

    When grabbing data via client.last_received() from the suds.client.Client
    module, it returns the xml data in an un-helpful "<s:Envelope>" that needs
    to be removed. This function politely cleans it up.

    Parameters
    ----------
    wrapped_data: str
        Contains the wrapped xml results from a WSDL query
示例#10
0
def test_wsdl_retriever_get_link(mock_link_test, mock_taverna_parser,
                                 mock_webservice_parser):
    """
    Get a Taverna link
    """
    assert wsdl_retriever() == 'http://www.helio.uk/Taverna/hec?wsdl'
示例#11
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
示例#12
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Return None
    """
    assert wsdl_retriever() is None
示例#13
0
def test_wsdl_retriever_wsdl(mock_taverna_parser, mock_webservice_parser, mock_link_test):
    """
    Unable to find any valid Taverna URLs? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
示例#14
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Raise ValueError
    """
    with pytest.raises(ValueError):
        wsdl_retriever()
示例#15
0
def test_wsdl_retriever_no_taverna_urls(mock_taverna_parser,
                                        mock_webservice_parser):
    """
    Unable to find any valid Taverna URLs? Return None
    """
    assert wsdl_retriever() is None
示例#16
0
def test_wsdl_retriever_no_content(mock_endpoint_parser):
    """
    No links found? Return None
    """
    assert wsdl_retriever() is None
示例#17
0
def test_wsdl_retriever_no_taverna_urls(mock_taverna_parser, mock_webservice_parser):
    """
    Unable to find any valid Taverna URLs? Return None
    """
    assert wsdl_retriever() is None