Commit d29643a8 authored by Hugo Hörnquist's avatar Hugo Hörnquist

Add URL encoding.

parent 6e7b21a9
......@@ -8,6 +8,7 @@ except ImportError:
pass
import fuse
import urllib.request
import urllib.parse
import xml.etree.ElementTree as ET
import time
......@@ -47,7 +48,8 @@ def get_page(name):
"""
p = pages.get(name)
if not p:
request = urllib.request.urlopen(url.format(name))
u = url.format(urllib.parse.quote_plus(name))
request = urllib.request.urlopen(u)
info = request.info()
s = info.get("content-type")
charset = info.get_charset() or s[len("charset=") + s.find("charset="):]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment