Skip to content

Commit

Permalink
SOS handle username and password
Browse files Browse the repository at this point in the history
  • Loading branch information
pesekon2 committed May 31, 2017
1 parent cf402cd commit 3a56ec5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
27 changes: 21 additions & 6 deletions owslib/sos.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,25 @@
from .swe.observation import sos100, sos200


def SensorObservationService(url, version='1.0.0', xml=None):
"""sos factory function, returns a version specific SensorObservationService object"""
if version in ['1.0', '1.0.0']:
return sos100.SensorObservationService_1_0_0.__new__(sos100.SensorObservationService_1_0_0, url, version, xml)
def SensorObservationService(url,
version='1.0.0',
xml=None,
username=None,
password=None,):
"""
SOS factory function
:param url: url of capabilities document
:param version: SOS version 1.0.0 or 2.0.0
:param xml: elementtree object
:param username: username allowed to handle with SOS
:param password: password for the username
:return: a version specific SensorObservationService object
"""
if version in ['1.0', '1.0.0']:
return sos100.SensorObservationService_1_0_0.__new__(
sos100.SensorObservationService_1_0_0, url, version,
xml, username, password)
elif version in ['2.0', '2.0.0']:
return sos200.SensorObservationService_2_0_0.__new__(sos200.SensorObservationService_2_0_0, url, version, xml)

return sos200.SensorObservationService_2_0_0.__new__(
sos200.SensorObservationService_2_0_0, url, version,
xml, username, password)
2 changes: 1 addition & 1 deletion owslib/swe/observation/sos100.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SensorObservationService_1_0_0(object):
Implements ISensorObservationService.
"""

def __new__(self,url, version, xml=None, username=None, password=None):
def __new__(self, url, version, xml=None, username=None, password=None):
"""overridden __new__ method"""
obj=object.__new__(self)
obj.__init__(url, version, xml, username, password)
Expand Down

0 comments on commit 3a56ec5

Please sign in to comment.