Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch and raise HTTP 403 Forbidden errors #958

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion owslib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def openURL(url_base, data=None, method='Get', cookies=None, username=None, pass

req = requests.request(method.upper(), url_base, headers=headers, **rkwargs)

if req.status_code in [400, 401]:
if req.status_code in [400, 401, 403]:
raise ServiceException(req.text)

if req.status_code in [404, 500, 502, 503, 504]: # add more if needed
Expand Down
9 changes: 7 additions & 2 deletions tests/test_wms_getmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ def wms():
return WebMapService_1_3_0(SERVICE_URL, version='1.3.0')


def test_build_getmap_request_bbox_precision(wms):
@pytest.mark.parametrize("version", ["1.3.0", "1.1.1"])
def test_build_getmap_request_bbox_precision(version):
bbox = (-126.123456789, 24.123456789, -66.123456789, 50.123456789)
bbox_yx = (bbox[1], bbox[0], bbox[3], bbox[2])
request = wms._WebMapService_1_3_0__build_getmap_request(

m = mock.Mock()
type(m).version = mock.PropertyMock(return_value=version)

request = WebMapService_1_3_0._WebMapService_1_3_0__build_getmap_request(m,
layers=['layer1'],
styles=['default'],
srs='EPSG:4326',
Expand Down
Loading