Skip to content

Commit 79f9430

Browse files
authored
drop last bits of python 2 (#659)
* drop last bits of python 2 * drop py35 support
1 parent 4d4f068 commit 79f9430

File tree

8 files changed

+14
-31
lines changed

8 files changed

+14
-31
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
language: python
22
python:
3-
- "3.5"
43
- "3.6"
54
- "3.7"
65
- "3.8"

owslib/feature/common.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
from io import StringIO
21
from owslib.etree import etree
32
from owslib.util import Authentication, openURL
43

54
from urllib.parse import urlencode, parse_qsl
65

76

8-
def makeStringIO(strval):
9-
"""
10-
Helper method to make sure the StringIO being returned will work.
11-
12-
Differences between Python 2.7/3.x mean we have a lot of cases to handle.
13-
14-
TODO: skipped Python 2.x support. Is this still necessary?
15-
"""
16-
return StringIO(strval.decode())
17-
18-
197
class WFSCapabilitiesReader(object):
208
"""Read and parse capabilities document into a lxml.etree infoset
219
"""

owslib/feature/wfs100.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from owslib import util
1010

11+
from io import BytesIO
1112
from urllib.parse import urlencode
1213
from owslib.util import (
1314
testXMLValue,
@@ -27,7 +28,6 @@
2728
from owslib.feature.common import (
2829
WFSCapabilitiesReader,
2930
AbstractContentMetadata,
30-
makeStringIO,
3131
)
3232

3333
import pyproj
@@ -308,16 +308,16 @@ def getfeature(
308308
tree = etree.fromstring(data)
309309
except BaseException:
310310
# Not XML
311-
return makeStringIO(data)
311+
return BytesIO(data)
312312
else:
313313
if tree.tag == "{%s}ServiceExceptionReport" % OGC_NAMESPACE:
314314
se = tree.find(nspath("ServiceException", OGC_NAMESPACE))
315315
raise ServiceException(str(se.text).strip())
316316
else:
317-
return makeStringIO(data)
317+
return BytesIO(data)
318318
else:
319319
if have_read:
320-
return makeStringIO(data)
320+
return BytesIO(data)
321321
return u
322322

323323
def getOperationByName(self, name):

owslib/feature/wfs110.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# Contact email: tomkralidis@gmail.com
88
# =============================================================================
99

10+
from io import BytesIO
1011
from urllib.parse import urlencode
1112
from owslib.util import (
1213
testXMLValue,
@@ -33,7 +34,6 @@
3334
from owslib.feature.common import (
3435
WFSCapabilitiesReader,
3536
AbstractContentMetadata,
36-
makeStringIO,
3737
)
3838
from owslib.namespaces import Namespaces
3939
from owslib.util import log, openURL
@@ -346,16 +346,16 @@ def getfeature(
346346
tree = etree.fromstring(data)
347347
except BaseException:
348348
# Not XML
349-
return makeStringIO(data)
349+
return BytesIO(data)
350350
else:
351351
if tree.tag == "{%s}ServiceExceptionReport" % namespaces["ogc"]:
352352
se = tree.find(nspath_eval("ServiceException", namespaces["ogc"]))
353353
raise ServiceException(str(se.text).strip())
354354
else:
355-
return makeStringIO(data)
355+
return BytesIO(data)
356356
else:
357357
if have_read:
358-
return makeStringIO(data)
358+
return BytesIO(data)
359359
return u
360360

361361
def getOperationByName(self, name):

owslib/feature/wfs200.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
from owslib.feature.common import (
1919
WFSCapabilitiesReader,
2020
AbstractContentMetadata,
21-
makeStringIO,
2221
)
2322
from owslib.namespaces import Namespaces
2423

2524
# other imports
25+
from io import BytesIO
2626
from urllib.parse import urlencode
2727

2828
import logging
@@ -313,16 +313,16 @@ def getfeature(
313313
tree = etree.fromstring(data)
314314
except BaseException:
315315
# Not XML
316-
return makeStringIO(data)
316+
return BytesIO(data)
317317
else:
318318
if tree.tag == "{%s}ServiceExceptionReport" % OGC_NAMESPACE:
319319
se = tree.find(nspath("ServiceException", OGC_NAMESPACE))
320320
raise ServiceException(str(se.text).strip())
321321
else:
322-
return makeStringIO(data)
322+
return BytesIO(data)
323323
else:
324324
if have_read:
325-
return makeStringIO(data)
325+
return BytesIO(data)
326326
return u
327327

328328
def getpropertyvalue(

requirements-dev.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,3 @@ pytest>=3.6
44
pytest-cov
55
Pillow
66
tox
7-
# install libraries to stop SSL related InsecurePlatformWarning
8-
pyopenssl ; python_version < '2.7.9'
9-
ndg-httpsclient ; python_version < '2.7.9'
10-
pyasn1 ; python_version < '2.7.9'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def run_tests(self):
2828
maintainer_email = 'tomkralidis@gmail.com',
2929
url = 'https://geopython.github.io/OWSLib',
3030
install_requires = reqs,
31-
python_requires = '>=3.5',
31+
python_requires = '>=3.6',
3232
cmdclass = {'test': PyTest},
3333
packages = find_packages(exclude=["docs", "etc", "examples", "tests"]),
3434
classifiers = [

tests/doctests/wfs_MapServerWFSFeature.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Test the getfeature method
77

88
>>> wfs = WebFeatureService('http://nsidc.org/cgi-bin/atlas_south?', version='1.0.0')
99
>>> response = wfs.getfeature(typename=['glaciers'], maxfeatures=5)
10-
>>> response.read().find('<wfs:FeatureCollection') > 0
10+
>>> response.read().find(b'<wfs:FeatureCollection') > 0
1111
True
1212

1313
Handle service exception

0 commit comments

Comments
 (0)