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

Side by Side Diff: modules/geoip/files/update.py

Issue 29341151: Issue 4019 - Added "Edge" to platform choices in Issues tracker at issues1. (Closed)
Patch Set: Created May 10, 2016, 3:35 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/fluent/templates/td-gpg-key.erb ('k') | modules/logstash/files/logstash.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import urllib 3 import urllib
4 import zlib 4 import zlib
5 5
6 downloads = { 6 downloads = {
7 '/usr/share/GeoIP/GeoIP.dat': 'http://geolite.maxmind.com/download/geoip/dat abase/GeoLiteCountry/GeoIP.dat.gz', 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/d atabase/GeoIPv6.dat.gz', 8 '/usr/share/GeoIP/GeoIPv6.dat': 'http://geolite.maxmind.com/download/geoip/dat abase/GeoIPv6.dat.gz',
9 9
10 '/usr/share/GeoIP/GeoIPCity.dat': 'http://geolite.maxmind.com/download/geoip /database/GeoLiteCity.dat.gz', 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/geo ip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz', 11 '/usr/share/GeoIP/GeoIPCityv6.dat': 'http://geolite.maxmind.com/download/geoip /database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz',
12 } 12 }
13 13
14 for dest, source in downloads.iteritems(): 14 for dest, source in downloads.iteritems():
15 data = urllib.urlopen(source).read() 15 data = urllib.urlopen(source).read()
16 with open(dest, "wb") as f: 16 with open(dest, "wb") as f:
17 # wbit parameter value isn't properly documented, see https://stackoverf low.com/a/22310760/785541 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)) 18 f.write(zlib.decompress(data, zlib.MAX_WBITS | 16))
OLDNEW
« no previous file with comments | « modules/fluent/templates/td-gpg-key.erb ('k') | modules/logstash/files/logstash.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld