Thanks for the reply. Not being able o see the image is strange. It’s hosted in imgur, a well known and very used server to post images! But it doesn’t mater. The image is similar to the one from user @holeu above.
I think my problem is specifically tied to the Qt QWebEngineView widget. It’s using a static page to display OSM map tiles, that I know. If I put the exact same page in my webserver and point my application to use that one to access OSM servers things work correctly.
Nonetheless, some of the answers in the posts above gave me some ideas to try to tackle this proble. I only wonder why the error does not pop up when using OSM server in Germany (I haven’t tested others). Could this be related to the fact that I’m in Europe?
Note the URL, which is a Qt resource (a simple html page embedded in the executable). But what to use as a Referrer in the `Referer header’? This is a prototype application. It will eventually have a Codeberg repository. But should I use it as the referrer? I’ve tried with an old but existent GitHub repository (not related with this project) and I still get the error!
Setting fakes will not help. Rather think about setting a unique User Agent that would have you easily identified, maybe even with contact mail. So the osmf working group could identify you and contact you if they see a misuse. Otherwise they only have a chance in blocking requests if they see a misuse.
I’m sorry, I probably didn’t make myself clear: I haven’t used the fake example displayed above. I’ve tried the software with a true github URL, which is obviously unique, but it’s from a different project not related with this one. At this stage, this software has not yet a remote git repository. But using the unique github repository didn’t make any difference. The error still pops-up once in a while.
I think I’ll leave OSM servers alone and use a simple SVG world map rendered with Qt SVG widgets. I already managed to write the widget and render an SVG map since I started this thread. This way, mapping will be totally independent from internet connection. Now I only have to translate lat/long coordinates (of observations) into the SVG widget coordinates.
But thank you anyway. OSM is great, and for GPS purposes I excusively use OsmAnd~, not GMaps!
Is there any technical possibility to view OSM tiles from within a HTML file on local file opened by a browser (Firefox)? The mentioned solution is not applicable, as above the application is the browser and can be tweaked. I want to use a real unmodified browser. And I prefer to open the html from file:// and not run a webserver (also no tiny one).
I can’t modify UserAgent from within a page. This would require add-ons in the browser.
I can’t set a referrer to a value, as this is blocked by the browser
By default it does not send any referrer for file:// URLs.
I can replace Tile layer with a custom one to pass details to fetch(), but even setting referrerPolicy to “origin” fails to send a referrer as browser does not send it, probably due to CORS null-origin
How do I do this in python? I’m getting 403r through a local html page generated with geopandas and mapclassify/folium. I can’t find any good documentation or forum posts about how to create a user agent to send in a request with python.
I saved it as an html file and opened it because I wanted to try adding the map I generate to the website, but I don’t know the correct way to do that yet. It doesn’t show 403r when I run the code in jupyterlab.