convert some left over readUrls to read_url

This commit is contained in:
j 2012-09-06 13:25:57 +02:00
parent 7ebfdaff30
commit 3a0c35372d
3 changed files with 5 additions and 5 deletions

View file

@ -112,7 +112,7 @@ def save_url(url, filename, overwrite=False):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
data = readUrl(url)
data = read_url(url)
f = open(filename, 'w')
f.write(data)
f.close()

View file

@ -87,7 +87,7 @@ def save_url(url, filename, overwrite=False):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
data = readUrl(url)
data = read_url(url)
f = open(filename, 'w')
f.write(data)
f.close()

View file

@ -9,7 +9,7 @@ def get_embed_code(url, maxwidth=None, maxheight=None):
embed = {}
header = cache.get_headers(url)
if header.get('content-type', '').startswith('text/html'):
html = cache.readUrl(url)
html = cache.read_url(url)
json_oembed = filter(lambda l: 'json+oembed' in l, re.compile('<link.*?>').findall(html))
xml_oembed = filter(lambda l: 'xml+oembed' in l, re.compile('<link.*?>').findall(html))
if json_oembed:
@ -18,14 +18,14 @@ def get_embed_code(url, maxwidth=None, maxheight=None):
oembed_url += '&maxwidth=%d' % maxwidth
if maxheight:
oembed_url += '&maxheight=%d' % maxheight
embed = json.loads(cache.readUrl(oembed_url))
embed = json.loads(cache.read_url(oembed_url))
elif xml_oembed:
oembed_url = find_re(json_oembed[0], 'href="(.*?)"')
if maxwidth:
oembed_url += '&maxwidth=%d' % maxwidth
if maxheight:
oembed_url += '&maxheight=%d' % maxheight
data = cache.readUrl(oembed_url)
data = cache.read_url(oembed_url)
for e in ET.fromstring(data):
embed[e.tag] = e.text
return embed