pvxe / nftables-geoip

Python script that generates nft maps of ip address blocks and corresponding geolocation. This data is taken from db-ip.com, so yo don't have to worry about accepting any EULA.
GNU General Public License v2.0
115 stars 17 forks source link

DB download does not exist due to date tick over #6

Open rayleroux opened 3 years ago

rayleroux commented 3 years ago

"Error trying to download DB-IP lite geoip csv file. Bailing out..." when trying to download free DB as 2021-02 does not exist yet.

I've modified it to get 2021-01 but to add some resiliency to the script you could attempt the previous month on failure.

This is the line where the problem exists.

url = 'https://download.db-ip.com/free/dbip-country-lite-{}.csv.gz'.format(time.strftime("%Y-%m"))

pvxe commented 3 years ago

Handling this case may seem reasonable. But testing with the past month database would be useless if data is outdated, wouldn't it?. I imagine that some of the cidr do not change its geolocation data that frequently but I have no experience nor knowledge to prove so.

I agree that the script being unusable first day of the month is weird. I'll look into it (the moment I get some more free time). If no better idea comes to mind it could be patched with yours.

Thank you for reporting this :+1: