I have a method that returns the following error message (the problem is in the accents)
urlopen error [Errno 10061] A connection cannot be established because the destination computer expressly denied the connection
When trying to do json.dumps in python I get the error:
'ascii' codec can't decode byte .....
I know it's not a json error because it marks the same thing when calling the print method, but I haven't been able to
I tried:
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
variable.encode("utf8")
How can I get the string with the accents and be able to use json.dumps()
?