comparison make-tld-conf.py @ 276:19ff60eaab74

more tld entries
author Carl Byington <carl@five-ten-sg.com>
date Fri, 15 Nov 2013 13:34:53 -0800
parents f92f24950bd3
children 6497944a9bd9
comparison
equal deleted inserted replaced
275:f3b003554a19 276:19ff60eaab74
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 import os, sys 3 import os, sys, time
4 4
5 def cmd(c): 5 def cmd(c):
6 return os.popen(c).read().rstrip('\n') 6 return os.popen(c).read().rstrip('\n')
7 7
8 8
9 c = 'curl http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 2>/dev/null' 9 c = 'curl http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/effective_tld_names.dat?raw=1 2>/dev/null'
10 content = cmd(c) 10 content = cmd(c)
11 f=open('tld.conf','w') 11 f=open('tld.conf','w')
12 f.write(time.strftime("// generated by make-tld-conf.py on %Y-%m-%d %H:%M:%S\n\n"))
12 for x in content.split('\n'): 13 for x in content.split('\n'):
13 if (x == '') or (x[:2] == '//'): f.write('%s\n' % x) 14 if (x == '') or (x[:2] == '//'): f.write('%s\n' % x)
14 else: 15 else:
15 if x[:1] == '!': 16 if x[:1] == '!':
16 x = x[1:] 17 x = x[1:]