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

two requests done on the WFS endpoint for a single WebFeatureService object creation #953

Closed
landryb opened this issue Oct 28, 2024 · 3 comments

Comments

@landryb
Copy link

landryb commented Oct 28, 2024

While working on some caching code for my own project using owslib, i was puzzled to see two requests on the remote service.. and quickly figured out it was owslib itself doing two requests, for the creation of a single object.

>>> from owslib.wfs import WebFeatureService
>>> x = WebFeatureService('https://xxx/wxs/geor_loc/ows', version='1.1.0')

triggers this in the remote service accesslog

127.0.0.1 - - [28/Oct/2024:14:04:07 +0100] "GET /wxs/geor_loc/ows?service=WFS&request=GetCapabilities&version=1.1.0 HTTP/1.1" 200 4840 "-" "python-requests/2.28.1"
127.0.0.1 - - [28/Oct/2024:14:04:07 +0100] "GET /wxs/geor_loc/ows?service=WFS&request=GetCapabilities&version=1.1.0 HTTP/1.1" 200 4840 "-" "python-requests/2.28.1"
127.0.0.1 - - [28/Oct/2024:14:07:16 +0100] "GET /wxs/geor_loc/ows?service=WFS&request=GetCapabilities&version=1.1.0 HTTP/1.1" 200 4840 "-" "python-requests/2.32.2"
127.0.0.1 - - [28/Oct/2024:14:07:16 +0100] "GET /wxs/geor_loc/ows?service=WFS&request=GetCapabilities&version=1.1.0 HTTP/1.1" 200 4840 "-" "python-requests/2.32.2"

reproducible with owslib 0.31.0 (the second set of requests) and 0.27.2 (the version shipped with debian 12, and first set of requests) - i dont see the same behaviour with WMS 1.3.0 or 1.1.1, so that seems specific to WFS, and happens for WFS 1.1.1 and 2.0.0.

after a quick look at the code, i see https://github.com/geopython/OWSLib/blob/master/owslib/feature/wfs110.py#L207 and i wonder if the 'is redundant' comment is about that weird behaviour of if it comes from elsewhere, but doing two requests is suboptimal, especially if generating the capabilities document is expensive serverside.

@geographika
Copy link
Contributor

@landryb - I think this may be the same issue as #520 with possible fix in #548 (although I've not tested this yet).

@landryb
Copy link
Author

landryb commented Oct 31, 2024

@landryb - I think this may be the same issue as #520 with possible fix in #548 (although I've not tested this yet).

oh great, i can confirm #548 fixes the issue, tested it by locally removing the __new__ method only in wfs110.py, creating a WFS object with version='1.1.0' yields a single getcapabilities request, while doing the same call with version'=2.0.0' yields two getcapabilities requests.

@geographika
Copy link
Contributor

Fixed with #548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants