switch to requests for HTTP queries

This commit is contained in:
mutantmonkey
2013-06-08 22:27:24 -07:00
parent 259c222623
commit 5cb88f3cf8
23 changed files with 131 additions and 161 deletions

View File

@@ -17,8 +17,8 @@ NS = NS = '{urn:oasis:names:tc:DSML:2:0:core}'
def search(query):
query = web.quote(query)
try:
req = web.get(SEARCH_URL.format(query))
except (HTTPError, IOError):
req = web.get(SEARCH_URL.format(query), verify=False)
except (web.ConnectionError, web.HTTPError):
raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.")
xml = lxml.etree.fromstring(req.encode('utf-8'))