Solved

Accepting terms and conditions when using a HTTPCaller


Badge +3

Hey there.

 

Im trying to use the good'ol Creator->HTTPCaller->JSon'er method for the data here:

https://www.fega.gob.es/atom/es.fega.sigpac.xml

 

Where I am basically sending requests to fetch certain part of the data and then do some analysing on it before exporting to a format. But there is a problem here which is that the service requests you to accept to terms and conditions before you can start fetching. 

 

Doing this through browser ain't a problem as you just click on the "LEER Y ACEPTAR LAS CONDICIONES" button and read through the document that pops-up and then press "ACEPTAR LLAS CONCIONES" which brings you to the data.

 

It is using the HTTPCaller where i have the problem, cause just fetching the data (through the same URL) gives me the _response_body:

<html>
<body>
No has aceptado las condiciones y no puedes ver los ficheros
</body>
</html>
 

or basically "You have not accepted the conditions"

 

Does anyone have suggestions how to include accepting the terms and conditions, thus getting to the data itself, within a workspace?

 

PS there is a QGIS python plugin for the same purpose here if that helps:

GitHub - geomatico/qgis-sigpac: Plugin to download SIGPAC parcels

 

-Hlynur

icon

Best answer by david_r 13 April 2023, 17:32

View original

2 replies

Userlevel 4

Looking at the page and corresponding JS code, it seems there is a session cookie that is set when you accept the license. It is, however, theoretically possible to extract the cookie contents programmatically and pass it along with the request for the XML data, see the attached proof of concept (FME 2022.2).

imageAttention: In no way, shape or form am I condoning or suggesting that you access the dataset programmatically and without physically accepting the license agreement, unless you have the explicit and written permission from the data owners. This post is for educational purposes only.

Badge +3

Looking at the page and corresponding JS code, it seems there is a session cookie that is set when you accept the license. It is, however, theoretically possible to extract the cookie contents programmatically and pass it along with the request for the XML data, see the attached proof of concept (FME 2022.2).

imageAttention: In no way, shape or form am I condoning or suggesting that you access the dataset programmatically and without physically accepting the license agreement, unless you have the explicit and written permission from the data owners. This post is for educational purposes only.

Works like a charm, only theoretically of course, thanks for the help!

Reply