fix .google unicode query handling
This commit is contained in:
parent
a92e02f4d8
commit
81ca14fcf0
|
@ -9,6 +9,7 @@ from util import hook
|
||||||
def api_get(kind, query):
|
def api_get(kind, query):
|
||||||
req_url = 'http://ajax.googleapis.com/ajax/services/search/%s?' \
|
req_url = 'http://ajax.googleapis.com/ajax/services/search/%s?' \
|
||||||
'v=1.0&safe=off&q=%s'
|
'v=1.0&safe=off&q=%s'
|
||||||
|
query = query.encode('utf8')
|
||||||
url = req_url % (kind, urllib.quote(query, safe=''))
|
url = req_url % (kind, urllib.quote(query, safe=''))
|
||||||
page = urllib.urlopen(url).read()
|
page = urllib.urlopen(url).read()
|
||||||
return json.loads(page)
|
return json.loads(page)
|
||||||
|
|
Loading…
Reference in New Issue