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

owslib.wms.WebMapService and owslib.wfs.WebFeatureService creation fails with application/octet-stream content-type services #983

Closed
SimonSAMPERE opened this issue Mar 18, 2025 · 4 comments

Comments

@SimonSAMPERE
Copy link

Hello,
I'm developing a plugin for QGIS and I've noticed that my code can no longer handle a particular OGC service in the latest stable version of QGIS. Here are the URLs of the services involved:

I've tried to investigate and to sum up, the following python code works well with owslib version 0.29.2 but not with version 0.32.0:

from owslib.wms import WebMapService
from owslib.wfs import WebFeatureService


wfs_url = "https://inpn.mnhn.fr/webgeoservice/WFS/fxx_inpn?"
wfs_version = "2.0.0"

wfs = WebFeatureService(
    url= wfs_url,
    version = wfs_version
)
print(wfs.identification)

wms_url = "https://inpn.mnhn.fr/webgeoservice/WMS/fxx_inpn?"
wms_version = "1.3.0"

wms = WebMapService(
    url= wms_url,
    version = wms_version
)
print(wms.identification)

With owslib 0.32.0 a ValuError is raised by the getXMLTree method of util.py.

Here are some files with the entire error using owslib 0.32.0:

Perhaps the problem lies in the fact that these are services whose Content-Type is ‘application/octet-stream’ and not ‘application/xml’.
I don't know if this is a bug or if I just couldn't find the information on how to handle this with owslib 0.32.0. In any case, is there a workaround for this problem?

@SimonSAMPERE SimonSAMPERE changed the title owslib.wms.WebMapService and owslib.wfs.WebFeatureService creation fails with application/xml content-type services owslib.wms.WebMapService and owslib.wfs.WebFeatureService creation fails with application/octet-stream content-type services Mar 18, 2025
@SimonSAMPERE
Copy link
Author

I've implemented a workaround in the code of my plugin to parse the XML directly.
I hope that this PR will be approved, that it will lead to the publication of a new version of owslib and that this new version will be quickly integrated into a future version of QGIS. 🤞🏼
Anyway, congratulations and thank you @geographika for your responsiveness.

@SimonSAMPERE
Copy link
Author

According to me this issue can be closed

@geographika
Copy link
Contributor

@SimonSAMPERE #984 has been merged and is part of the https://github.com/geopython/OWSLib/releases/tag/0.33.0 release, which was published yesterday.

@SimonSAMPERE
Copy link
Author

yes I received the notification, thank you @geographika

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