In [1]:
import requests, json

In [2]:
headers = {'Content-Type': 'application/xml'}

In [3]:
input='''
<csw:GetRecords xmlns:csw="http://www.opengis.net/cat/csw/2.0.2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc"
    xmlns:gml="http://www.opengis.net/gml" outputSchema="http://www.opengis.net/cat/csw/2.0.2"
    outputFormat="application/xml" version="2.0.2" service="CSW" resultType="results"
    maxRecords="1000"
    xsi:schemaLocation="http://www.opengis.net/cat/csw/2.0.2 http://schemas.opengis.net/csw/2.0.2/CSW-discovery.xsd">
    <csw:Query typeNames="csw:Record">
        <csw:ElementSetName>full</csw:ElementSetName>
        <csw:Constraint version="1.1.0">
            <ogc:Filter>
                   <ogc:PropertyIsLike wildCard="*" singleChar="?" escapeChar="\">
                        <ogc:PropertyName>apiso:AnyText</ogc:PropertyName>
                        <ogc:Literal>*temp*</ogc:Literal>
                    </ogc:PropertyIsLike>
            </ogc:Filter>
        </csw:Constraint>
    </csw:Query>
</csw:GetRecords>
''';

In [4]:
endpoint = 'http://data.nodc.noaa.gov/geoportal/csw'  
xml_string=requests.post(endpoint, data=input, headers=headers).text
print(xml_string[:2000])


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<csw:GetRecordsResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcmiBox="http://dublincore.org/documents/2000/07/11/dcmi-box/" xmlns:dct="http://purl.org/dc/terms/" xmlns:gml="http://www.opengis.net/gml" xmlns:ows="http://www.opengis.net/ows" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<csw:SearchStatus timestamp="2016-12-09T15:09:31+00:00"/>
<csw:SearchResults elementSet="full" nextRecord="1001" numberOfRecordsMatched="27793" numberOfRecordsReturned="1000" recordSchema="http://www.opengis.net/cat/csw/2.0.2">
<csw:Record>
<dc:identifier scheme="urn:x-esri:specification:ServiceType:ArcIMS:Metadata:FileID">gov.noaa.nodc:0001122</dc:identifier>
<dc:identifier scheme="urn:x-esri:specification:ServiceType:ArcIMS:Metadata:DocID">{B3826B28-52DC-4529-A385-D76C073643EE}</dc:identifier>
<dc:title>Oceanographic profile temperature, salinity and other measurements collected using bottle from the TEMP in the Arctic from 1947 to 1949 (NODC Accession 0001122)</dc:title>
<dc:type scheme="urn:x-esri:specification:ServiceType:ArcIMS:Metadata:ContentType">application</dc:type>
<dc:type scheme="urn:x-esri:specification:ServiceType:ArcIMS:Metadata:ContentType">application</dc:type>
<dc:type scheme="urn:x-esri:specification:ServiceType:ArcIMS:Metadata:ContentType">downloadableData</dc:type>
<dc:type scheme="urn:x-esri:specification:ServiceType:ArcIMS:Metadata:ContentType">downloadableData</dc:type>
<dc:subject>DOC/NOAA/NESDIS/NODC &gt; National Oceanographic Data Center, NESDIS, NOAA, U.S. Department of Commerce</dc:subject>
<dc:subject>DOC/NOAA/NESDIS/NCEI &gt; National Centers for Environmental Information, NESDIS, NOAA, U.S. Department of Commerce</dc:subject>
<dc:subject>oceanography</dc:subject>
<dc:subject>GODAR &gt; Global Oceanographic Data Archaeology and Rescue Project</dc:subject>
<dc:subject>EARTH SCIENCE &gt; OCEANS &gt; OCEAN TEMPERATURE &gt; WATER TEMPERATURE

In [5]:
endpoint = 'http://www.ngdc.noaa.gov/geoportal/csw'
xml_string=requests.post(endpoint, data=input, headers=headers).text
print(xml_string[:2000])


<?xml version="1.0" encoding="UTF-8"?>
<ExceptionReport version="1.2.0" xmlns="http://www.opengis.net/ows">
<Exception exceptionCode="MissingParameterValue" locator="request">
<ExceptionText>
Missing parameter value: locator=request
</ExceptionText>
<ExceptionText>
The parameter value was missing.
</ExceptionText>
</Exception>
</ExceptionReport>

In [ ]: