[owslib] 01/05: Imported Upstream version 0.8.10
Johan Van de Wauw
johanvdw-guest at moszumanska.debian.org
Thu Oct 16 23:22:56 UTC 2014
This is an automated email from the git hooks/post-receive script.
johanvdw-guest pushed a commit to branch master
in repository owslib.
commit 303d806bb7134909a4c442924df1d545c10d9473
Author: Johan Van de Wauw <johan at wp1573.fritz.box>
Date: Fri Oct 17 00:35:29 2014 +0200
Imported Upstream version 0.8.10
---
LICENSE.txt | 2 +-
OWSLib.egg-info/PKG-INFO | 2 +-
OWSLib.egg-info/SOURCES.txt | 4 +--
PKG-INFO | 2 +-
VERSION.txt | 2 +-
owslib/__init__.py | 2 +-
owslib/csw.py | 8 +++++-
owslib/feature/wfs200.py | 4 +--
owslib/ows.py | 2 ++
owslib/swe/observation/sos100.py | 16 +++++++++--
owslib/swe/observation/sos200.py | 12 +++++++--
owslib/wps.py | 52 ++++++++++++++++-------------------
tests/__init__.py | 0
tests/utils.py | 58 ----------------------------------------
14 files changed, 64 insertions(+), 102 deletions(-)
diff --git a/LICENSE.txt b/LICENSE.txt
index 2f1ad07..33e4ab5 100644
--- a/LICENSE.txt
+++ b/LICENSE.txt
@@ -10,7 +10,7 @@ modification, are permitted provided that the following conditions are met:
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- * Neither the name of the University of North Carolina nor the names of
+ * Neither the name of the Ancient World Mapping Center nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
diff --git a/OWSLib.egg-info/PKG-INFO b/OWSLib.egg-info/PKG-INFO
index 85b2d7c..9227ad9 100644
--- a/OWSLib.egg-info/PKG-INFO
+++ b/OWSLib.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: OWSLib
-Version: 0.8.9
+Version: 0.8.10
Summary: OGC Web Service utility library
Home-page: http://geopython.github.io/OWSLib
Author: Tom Kralidis
diff --git a/OWSLib.egg-info/SOURCES.txt b/OWSLib.egg-info/SOURCES.txt
index 2bff95a..92df1f4 100644
--- a/OWSLib.egg-info/SOURCES.txt
+++ b/OWSLib.egg-info/SOURCES.txt
@@ -56,6 +56,4 @@ owslib/swe/sensor/sml.py
owslib/waterml/__init__.py
owslib/waterml/wml.py
owslib/waterml/wml10.py
-owslib/waterml/wml11.py
-tests/__init__.py
-tests/utils.py
\ No newline at end of file
+owslib/waterml/wml11.py
\ No newline at end of file
diff --git a/PKG-INFO b/PKG-INFO
index 85b2d7c..9227ad9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: OWSLib
-Version: 0.8.9
+Version: 0.8.10
Summary: OGC Web Service utility library
Home-page: http://geopython.github.io/OWSLib
Author: Tom Kralidis
diff --git a/VERSION.txt b/VERSION.txt
index 55485e1..ef50561 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.8.9
+0.8.10
diff --git a/owslib/__init__.py b/owslib/__init__.py
index 462a7c5..c2c9176 100644
--- a/owslib/__init__.py
+++ b/owslib/__init__.py
@@ -1 +1 @@
-__version__ = '0.8.9'
+__version__ = '0.8.10'
diff --git a/owslib/csw.py b/owslib/csw.py
index ccbf64d..d24a399 100644
--- a/owslib/csw.py
+++ b/owslib/csw.py
@@ -10,6 +10,7 @@
""" CSW request and response processor """
import base64
+import inspect
import warnings
import StringIO
import random
@@ -601,7 +602,10 @@ class CatalogueServiceWeb:
# If skip_caps=True, then self.operations has not been set, so use
# default URL.
if hasattr(self, 'operations'):
- for op in self.operations:
+ caller = inspect.stack()[1][3]
+ if caller == 'getrecords2': caller = 'getrecords'
+ try:
+ op = self.get_operation_by_name(caller)
post_verbs = filter(lambda x: x.get('type').lower() == 'post', op.methods)
if len(post_verbs) > 1:
# Filter by constraints. We must match a PostEncoding of "XML"
@@ -612,6 +616,8 @@ class CatalogueServiceWeb:
xml_post_url = post_verbs[0].get('url')
elif len(post_verbs) == 1:
xml_post_url = post_verbs[0].get('url')
+ except: # no such luck, just go with xml_post_url
+ pass
self.request = cleanup_namespaces(self.request)
# Add any namespaces used in the "typeNames" attribute of the
diff --git a/owslib/feature/wfs200.py b/owslib/feature/wfs200.py
index d805ded..2659d38 100644
--- a/owslib/feature/wfs200.py
+++ b/owslib/feature/wfs200.py
@@ -255,7 +255,7 @@ class WebFeatureService_2_0_0(WebFeatureService_):
request = {'service': 'WFS', 'version': self.version, 'request': 'ListStoredQueries'}
encoded_request = urlencode(request)
- u = urlopen(base_url + encoded_request, timeout=timeout)
+ u = urlopen(base_url, data=encoded_request, timeout=timeout)
tree=etree.fromstring(u.read())
tempdict={}
for sqelem in tree[:]:
@@ -275,7 +275,7 @@ class WebFeatureService_2_0_0(WebFeatureService_):
base_url = self.url
request = {'service': 'WFS', 'version': self.version, 'request': 'DescribeStoredQueries'}
encoded_request = urlencode(request)
- u = urlopen(base_url + encoded_request, timeout=timeout)
+ u = urlopen(base_url, data=encoded_request, timeout=timeout)
tree=etree.fromstring(u.read())
tempdict2={}
for sqelem in tree[:]:
diff --git a/owslib/ows.py b/owslib/ows.py
index cb5ade5..24bf51c 100644
--- a/owslib/ows.py
+++ b/owslib/ows.py
@@ -162,6 +162,8 @@ class Constraint(object):
class OperationsMetadata(object):
"""Initialize an OWS OperationMetadata construct"""
def __init__(self, elem, namespace=DEFAULT_OWS_NAMESPACE):
+ if 'name' not in elem.attrib: # This is not a valid element
+ return
self.name = elem.attrib['name']
self.formatOptions = ['text/xml']
parameters = []
diff --git a/owslib/swe/observation/sos100.py b/owslib/swe/observation/sos100.py
index ca61c69..cc070df 100644
--- a/owslib/swe/observation/sos100.py
+++ b/owslib/swe/observation/sos100.py
@@ -115,6 +115,10 @@ class SensorObservationService_1_0_0(object):
assert isinstance(procedure, str)
request['procedure'] = procedure
+
+ url_kwargs = {}
+ if 'timeout' in kwargs:
+ url_kwargs['timeout'] = kwargs.pop('timeout') # Client specified timeout value
# Optional Fields
if kwargs:
@@ -123,7 +127,11 @@ class SensorObservationService_1_0_0(object):
data = urlencode(request)
- response = openURL(base_url, data, method, username=self.username, password=self.password).read()
+
+ response = openURL(base_url, data, method, username=self.username, password=self.password, **url_kwargs).read()
+
+
+
tr = etree.fromstring(response)
if tr.tag == nspath_eval("ows:ExceptionReport", namespaces):
@@ -168,6 +176,10 @@ class SensorObservationService_1_0_0(object):
# Optional Fields
if eventTime is not None:
request['eventTime'] = eventTime
+
+ url_kwargs = {}
+ if 'timeout' in kwargs:
+ url_kwargs['timeout'] = kwargs.pop('timeout') # Client specified timeout value
if kwargs:
for kw in kwargs:
@@ -175,7 +187,7 @@ class SensorObservationService_1_0_0(object):
data = urlencode(request)
- response = openURL(base_url, data, method, username=self.username, password=self.password).read()
+ response = openURL(base_url, data, method, username=self.username, password=self.password, **kwargs).read()
try:
tr = etree.fromstring(response)
if tr.tag == nspath_eval("ows:ExceptionReport", namespaces):
diff --git a/owslib/swe/observation/sos200.py b/owslib/swe/observation/sos200.py
index 08ab141..0cf2bb2 100644
--- a/owslib/swe/observation/sos200.py
+++ b/owslib/swe/observation/sos200.py
@@ -118,6 +118,10 @@ class SensorObservationService_2_0_0(object):
assert isinstance(procedure, str)
request['procedure'] = procedure
+
+ url_kwargs = {}
+ if 'timeout' in kwargs:
+ url_kwargs['timeout'] = kwargs.pop('timeout') # Client specified timeout value
# Optional Fields
if kwargs:
@@ -126,7 +130,7 @@ class SensorObservationService_2_0_0(object):
data = urlencode(request)
- response = openURL(base_url, data, method, username=self.username, password=self.password).read()
+ response = openURL(base_url, data, method, username=self.username, password=self.password, **url_kwargs).read()
tr = etree.fromstring(response)
if tr.tag == nspath_eval("ows:ExceptionReport", namespaces):
@@ -168,6 +172,10 @@ class SensorObservationService_2_0_0(object):
# Optional Fields
if eventTime is not None:
request['temporalFilter'] = eventTime
+
+ url_kwargs = {}
+ if 'timeout' in kwargs:
+ url_kwargs['timeout'] = kwargs.pop('timeout') # Client specified timeout value
if kwargs:
for kw in kwargs:
@@ -175,7 +183,7 @@ class SensorObservationService_2_0_0(object):
data = urlencode(request)
- response = openURL(base_url, data, method, username=self.username, password=self.password).read()
+ response = openURL(base_url, data, method, username=self.username, password=self.password, **url_kwargs).read()
try:
tr = etree.fromstring(response)
if tr.tag == nspath_eval("ows:ExceptionReport", namespaces):
diff --git a/owslib/wps.py b/owslib/wps.py
index fb16ea6..3479fab 100644
--- a/owslib/wps.py
+++ b/owslib/wps.py
@@ -88,7 +88,7 @@ from owslib.etree import etree
from owslib.ows import DEFAULT_OWS_NAMESPACE, ServiceIdentification, ServiceProvider, OperationsMetadata
from time import sleep
from owslib.util import (testXMLValue, build_get_url, dump, getTypedValue,
- getNamespace, element_to_string, nspath, openURL, nspath_eval)
+ getNamespace, element_to_string, nspath, openURL, nspath_eval, log)
from xml.dom.minidom import parseString
from owslib.namespaces import Namespaces
@@ -196,8 +196,7 @@ class WebProcessingService(object):
else:
self._capabilities = reader.readFromUrl(self.url, username=self.username, password=self.password)
- if self.verbose==True:
- print element_to_string(self._capabilities)
+ log.debug(element_to_string(self._capabilities))
# populate the capabilities metadata obects from the XML tree
self._parseCapabilitiesMetadata(self._capabilities)
@@ -217,8 +216,7 @@ class WebProcessingService(object):
# read from server
rootElement = reader.readFromUrl(self.url, identifier)
- if self.verbose==True:
- print element_to_string(rootElement)
+ log.info(element_to_string(rootElement))
# build metadata objects
return self._parseProcessMetadata(rootElement)
@@ -236,15 +234,15 @@ class WebProcessingService(object):
"""
# instantiate a WPSExecution object
- print 'Executing WPS request...'
+ log.info('Executing WPS request...')
execution = WPSExecution(version=self.version, url=self.url, username=self.username, password=self.password, verbose=self.verbose)
# build XML request from parameters
if request is None:
requestElement = execution.buildRequest(identifier, inputs, output)
- request = etree.tostring( requestElement )
- if self.verbose==True:
- print request
+ request = etree.tostring( requestElement )
+ execution.request = request
+ log.debug(request)
# submit the request to the live server
if response is None:
@@ -252,8 +250,7 @@ class WebProcessingService(object):
else:
response = etree.fromstring(response)
- if self.verbose==True:
- print etree.tostring(response)
+ log.debug(etree.tostring(response))
# parse response
execution.parseResponse(response)
@@ -358,8 +355,7 @@ class WPSReader(object):
if method == 'Get':
# full HTTP request url
request_url = build_get_url(url, data)
- if self.verbose==True:
- print request_url
+ log.debug(request_url)
# split URL into base url and query string to use utility function
spliturl=request_url.split('?')
@@ -581,21 +577,20 @@ class WPSExecution():
# override status location
if url is not None:
self.statusLocation = url
- print '\nChecking execution status... (location=%s)' % self.statusLocation
+ log.info('\nChecking execution status... (location=%s)' % self.statusLocation)
response = reader.readFromUrl(self.statusLocation, username=self.username, password=self.password)
else:
response = reader.readFromString(response)
# store latest response
self.response = etree.tostring(response)
- if self.verbose==True:
- print self.response
+ log.debug(self.response)
self.parseResponse(response)
# sleep given number of seconds
if self.isComplete()==False:
- print 'Sleeping %d seconds...' % sleepSecs
+ log.info('Sleeping %d seconds...' % sleepSecs)
sleep(sleepSecs)
@@ -654,7 +649,7 @@ class WPSExecution():
out = open(filepath, 'wb')
out.write(content)
out.close()
- print 'Output written to file: %s' %filepath
+ log.info('Output written to file: %s' %filepath)
else:
raise Exception("Execution not successfully completed: status=%s" % self.status)
@@ -700,12 +695,12 @@ class WPSExecution():
self._parseExceptionReport(response)
else:
- print 'Unknown Response'
+ log.debug('Unknown Response')
- # print status, errors
- print 'Execution status=%s' % self.status
- print 'Percent completed=%s' % self.percentCompleted
- print 'Status message=%s' % self.statusMessage
+ # log status, errors
+ log.info('Execution status=%s' % self.status)
+ log.info('Percent completed=%s' % self.percentCompleted)
+ log.info('Status message=%s' % self.statusMessage)
for error in self.errors:
dump(error)
@@ -1026,7 +1021,6 @@ class Output(InputOutput):
if complexDataElement is not None:
self.dataType = "ComplexData"
self.mimeType = complexDataElement.get('mimeType')
- #print etree.tostring(complexDataElement)
if complexDataElement.text is not None and complexDataElement.text.strip() is not '':
self.data.append(complexDataElement.text.strip())
for child in complexDataElement:
@@ -1051,7 +1045,7 @@ class Output(InputOutput):
# a) 'http://cida.usgs.gov/climate/gdp/process/RetrieveResultServlet?id=1318528582026OUTPUT.601bb3d0-547f-4eab-8642-7c7d2834459e'
# b) 'http://rsg.pml.ac.uk/wps/wpsoutputs/outputImage-11294Bd6l2a.tif'
- print 'Output URL=%s' % url
+ log.info('Output URL=%s' % url)
if '?' in url:
spliturl=url.split('?')
u = openURL(spliturl[0], spliturl[1], method='Get', username = username, password = password)
@@ -1091,7 +1085,7 @@ class Output(InputOutput):
out = open(self.filePath, 'wb')
out.write(content)
out.close()
- print 'Output written to file: %s' %self.filePath
+ log.info('Output written to file: %s' %self.filePath)
class WPSException:
@@ -1336,7 +1330,7 @@ def monitorExecution(execution, sleepSecs=3, download=False, filepath=None):
while execution.isComplete()==False:
execution.checkStatus(sleepSecs=sleepSecs)
- print 'Execution status: %s' % execution.status
+ log.info('Execution status: %s' % execution.status)
if execution.isSucceded():
if download:
@@ -1344,10 +1338,10 @@ def monitorExecution(execution, sleepSecs=3, download=False, filepath=None):
else:
for output in execution.processOutputs:
if output.reference is not None:
- print 'Output URL=%s' % output.reference
+ log.info('Output URL=%s' % output.reference)
else:
for ex in execution.errors:
- print 'Error: code=%s, locator=%s, text=%s' % (ex.code, ex.locator, ex.text)
+ log.error('Error: code=%s, locator=%s, text=%s' % (ex.code, ex.locator, ex.text))
def printValue(value):
'''
diff --git a/tests/__init__.py b/tests/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/tests/utils.py b/tests/utils.py
deleted file mode 100644
index 72110af..0000000
--- a/tests/utils.py
+++ /dev/null
@@ -1,58 +0,0 @@
-import os
-from owslib.etree import etree
-from urlparse import urlparse
-
-def resource_file(filepath):
- return os.path.join(test_directory(), 'resources', filepath)
-
-def test_directory():
- """Helper function to return path to the tests directory"""
- return os.path.dirname(__file__)
-
-def scratch_directory():
- """Helper function to return path to the tests scratch directory"""
- return os.path.join(test_directory(), 'scratch')
-
-def scratch_file(filename):
- """Helper function to return file path in the tests scratch directory"""
- return os.path.join(scratch_directory(), filename)
-
-def compare_xml(a,b):
- if not isinstance(a, etree._Element):
- a = etree.fromstring(a)
- if not isinstance(b, etree._Element):
- b = etree.fromstring(b)
-
- return compare_elements(a,b)
-
-def compare_elements(a,b):
- # Tag
- if a.tag != b.tag:
- return False
- # Value
- if a.text != b.text:
- return False
- # Attributes
- if sorted(a.items()) != sorted(b.items()):
- return False
- # Children
- if len(list(a)) != len(list(b)):
- return False
- # Recurse
- for ac, bc in zip(list(a), list(b)):
- if not compare_elements(ac, bc):
- return False
-
- return True
-
-def cast_tuple_int_list(tup):
- """Set tuple float values to int for more predictable test results"""
- return [int(a) for a in tup]
-
-def cast_tuple_int_list_srs(tup):
- tup2 = cast_tuple_int_list(tup[:4])
- tup2.append(tup[-1])
- return tup2
-
-def sorted_url_query(url):
- return sorted(urlparse(url).query.split("&"))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/owslib.git
More information about the Pkg-grass-devel
mailing list