Super simple! Take a look at the great documentation of RIPE's stats API. In particular this section.
NOTE: this directory will export both the CIDR ranges (netblocks) as well as ASN lists of a country and copy the files to a web server's directory.
You need to have "jq" installed. Also availabe as packages for your favorite flavor of OS.