|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import datetime
|
|
|
|
|
import unicodedata
|
|
|
|
|
|
|
|
|
|
import dateutil.parser
|
|
|
|
|
import requests
|
|
|
|
@ -171,9 +172,15 @@ class Commands(object):
|
|
|
|
|
return clip
|
|
|
|
|
|
|
|
|
|
def query_cheese_com(self, query):
|
|
|
|
|
def remove_accents(s):
|
|
|
|
|
s = unicodedata.normalize('NFKD', s)
|
|
|
|
|
return ''.join([c for c in s if not unicodedata.combining(c)])
|
|
|
|
|
cc = CheeseCom()
|
|
|
|
|
try:
|
|
|
|
|
try:
|
|
|
|
|
result = cc.query(query)
|
|
|
|
|
except CheeseComError:
|
|
|
|
|
result = cc.query(remove_accents(query))
|
|
|
|
|
except CheeseComError:
|
|
|
|
|
raise CommandError('couldn\'t find exact match on cheese.com')
|
|
|
|
|
else:
|
|
|
|
|