This repository contains a few scripts I wrote to use the GBIF API with python.
You can use this function.
For usage, see for example: How many butterfly species do we have per continent?
See example here
The model is not good but the script could be reused for something else. See the notebook here