use current python-ox api

This commit is contained in:
j 2012-09-07 03:55:22 +02:00
parent d2859f10ef
commit 17bb6fb036
2 changed files with 4 additions and 4 deletions

View file

@ -328,7 +328,7 @@ def parse_txt():
def read_url(url): def read_url(url):
print 'reading', url print 'reading', url
return ox.cache.readUrl(url) if CACHE else ox.net.readUrl(url) return ox.cache.read_url(url) if CACHE else ox.net.read_url(url)
def read_wikipedia_url(id): def read_wikipedia_url(id):
url = 'http://en.wikipedia.org/wiki/' + encode_wikipedia_id(id) url = 'http://en.wikipedia.org/wiki/' + encode_wikipedia_id(id)
@ -371,4 +371,4 @@ if __name__ == '__main__':
get_imdb_languages() get_imdb_languages()
print json.dumps(LOGS, indent=4, sort_keys=True) print json.dumps(LOGS, indent=4, sort_keys=True)

View file

@ -90,7 +90,7 @@ units = [
'wb' 'wb'
] ]
txt = ox.cache.readUrlUnicode('http://unicode.org/Public/UNIDATA/NamesList.txt') txt = ox.cache.read_url('http://unicode.org/Public/UNIDATA/NamesList.txt', unicode=True)
lines = txt.split('\n') lines = txt.split('\n')
length = len(lines) length = len(lines)
chars = {} chars = {}
@ -167,4 +167,4 @@ f.close()
f = open('json/no_ascii.json', 'w') f = open('json/no_ascii.json', 'w')
f.write(json.dumps(sorted(no_ascii), indent=4)) f.write(json.dumps(sorted(no_ascii), indent=4))
f.close() f.close()