Phenological calendar for France


#1

Dear @lorenzo and @Geraldine,

may we humbly ask you if you are aware of any phenological information resources available for France to be able to do the same thing we are doing for Germany at Phänologischer Kalender - to find out about blooming periods of plants relevant for bees and beekeepers?

The phenodata program will be happy to accept yet another data source for acquiring phenological information ;].

With kind regards,
Andreas.


Phänologischer Kalender
#2

Hi Andreas,
I am happy you asked for that question.
As far as I know, two phenological sources are available in France.
The first one is http://apibotanica.inra.fr/ it has static blooming dates and although its name can induce into error, this is not an API. => some manual handling is needed.

On the other hand there is also a nice document edited by the french Agriculture department together with some research institutions “liste de plantes attractives pour les abeilles” (pdf). Again this is static data not linked to a geographic location. However I like the associated ranking displaying the pollen and nectar potential for each species.

Hope this can be useful :)
Lorenzo


#3

Dear Lorenzo,

thank you so much for this information. The latter two links just offer phenology information regarding blooming periods with monthly granularity, right? Additionally, we would have to parse the PDF file, which would not be easy as it is designed in a way which is more graphical than textual.

But - to the rescue! - http://apibotanica.inra.fr/ really does offer an API-based access to this information under the hood, which is great!

Accessing the relevant endpoints using HTTPie is easy after looking at the request data in the developer tools widget offered by contemporary browsers, just try that:

http POST 'http://apibotanica.inra.fr/botaniqueDB.json' \
     Content-Type:application/json-rpc id:=3 method='pLANTE' \
     params:='[0,150,0,150,null,1,null,1,null,1,null,1,null,1,null,1,null,1,53,0,"null",1]' \
     --print HBhb

Auxiliary information can be retrieved by additional calls like:

echo '{"params":["botaniqueDB","com.botaniquedb.data.Bota",null,{"properties":["id"],"filters":["id.idPlante=167"],"matchMode":"start","ignoreCase":false},{"orderBy":["desc: id.date "]}],"method":"read","id":18}' | \
http POST 'http://apibotanica.inra.fr/runtimeService.json' \
Content-Type:application/json-rpc --print HBhb

The API offers phenology/blooming information with calendar-week granularity. I am confident we can unlock the data reasonably after putting in a manageable amount of time into further investigation and implementation work.

Let’s schedule that as a task to add a second data source to our phenodata program to approach goals we outlined in this topic (Phänologischer Kalender) and in [RFC] Neue InfluxDB Datenquelle “BIENENJAHR”.

Thanks again and cheers,
Andreas.


#4

Hi Andreas,

Great news that you succeded in requesting the database.
I admit that I never went as deep as you did into the http requests.
Thank you for sharing the method, I’ve learnt it by the occasion.

There should be a little bug in the POST request as HTTPie sends the following error :

http: error: ConnectionError: HTTPConnectionPool(host='apibotanica.inra.fr', port=80): Max retries exceeded with url: /botaniqueDB.json (Caused by NewConnectionError('<urllib3.con
nection.HTTPConnection object at 0x7f67c8cffcc0>: Failed to establish a new connection: [Errno -2] Name or service not known',)) while doing POST request to URL: http://apibotanic
a.inra.fr/botaniqueDB.json

I have been playing a while with it but was not able to find what goes wrong with the request.

Regards
Lorenzo


#5

Hi Lorenzo,

looks strange, "Name or service not known" feels like the hostname cannot be resolved somehow. Can’t imagine what went wrong if accessing the page works from your browser on the same machine. Maybe some deviating proxy settings? Does running

http http://apibotanica.inra.fr/

actually give the same response?

Cheers,
Andreas.


#6

Hi Andreas,
this command gives the same error. Which is however strange because using

curl http://apibotanica.inra.fr/

gives the following result in HTTPie :

$ curl http://apibotanica.inra.fr/
curl: (6) Could not resolve host: apibotanica.

Although it seems to reach the server properly when executed from my terminal.

Regards
Lorenzo


#7

The answer itself looks strange, as (at leat here) curl answers with the FQDN as issued and not just only the host name part…
Is the machine in question able to resolve the URI with dig or host ?
Furthermore, if an ipv4 vs. ipv6 problem is involved: does change adding a -4 or -6 (force v4/v6 name resolver usage) anything?
(curl -4 http://apibotanica.inra.fr/ resp. curl -6 http://apibotanica.inra.fr/)


#8

yes, both dig and host work properly on my terminal

Furthermore, if an ipv4 vs. ipv6 problem is involved: does change adding a -4 or -6 (force v4/v6 name resolver usage) anything?
(curl -4 http://apibotanica.inra.fr/ resp. curl -6 http://apibotanica.inra.fr/)

On my terminal : “-4” ok / “-6” ko

However, in the HTTPie.org console both are ko :

$ curl -4 http://apibotanica.inra.fr/
curl: (6) Could not resolve host: apibotanica.inra.fr
$ curl -6 http://apibotanica.inra.fr/
curl: (6) Could not resolve host: apibotanica.inra.fr

I think the problem is really linked with HTTPie console more than with the host itself as it answers to requests sent from other terminals.


#9

Dear Lorenzo,

maybe we can finally resolve this problem. As you are referring to the “HTTPie.org console”, do you actually speak of the demo environment at HTTPie demo? If yes, we have to disappoint you, its disclaimer says it all:

here you can try httpie with a local httpbin.org,
there is no internet access so other sites won’t load


I agree, you should install HTTPie on your local machine, "{apt|brew|pip} install httpie" will be your friend.

With kind regards,
Andreas.

P.S.: You can alternatively just use curl for sending corresponding HTTP requests, but we prefer HTTPie as its input and output styles are way more lovely.


#10

Dear Andreas,
you are right, the disclaimer says it all, and I completely missed it
Oups :(

Lorenzo