Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: modules/statsmaster/files/cron_geoipdb_update.py

Issue 29326111: Issue 3010 - Introduce class geoip (Closed)
Patch Set: Created Sept. 8, 2015, 12:11 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « modules/geoip/manifests/init.pp ('k') | modules/statsmaster/manifests/init.pp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2
3 import urllib
4 import zlib
5
6 downloads = {
7 '/usr/share/GeoIP/GeoIP.dat': 'http://geolite.maxmind.com/download/geoip/datab ase/GeoLiteCountry/GeoIP.dat.gz',
8 '/usr/share/GeoIP/GeoIPv6.dat': 'http://geolite.maxmind.com/download/geoip/dat abase/GeoIPv6.dat.gz',
9
10 '/usr/share/GeoIP/GeoIPCity.dat': 'http://geolite.maxmind.com/download/geoip/d atabase/GeoLiteCity.dat.gz',
11 '/usr/share/GeoIP/GeoIPCityv6.dat': 'http://geolite.maxmind.com/download/geoip /database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz',
12 }
13
14 for dest, source in downloads.iteritems():
15 data = urllib.urlopen(source).read()
16 with open(dest, "wb") as f:
17 # wbit parameter value isn't properly documented, see https://stackoverflow. com/a/22310760/785541
18 f.write(zlib.decompress(data, zlib.MAX_WBITS | 16))
OLDNEW
« no previous file with comments | « modules/geoip/manifests/init.pp ('k') | modules/statsmaster/manifests/init.pp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld