Change str() to encode('utf-8')

Some error don't be displayed with Mastodon.py because it can't convert ascii with str(). So I change str to encode(utf-8)
This commit is contained in:
Dryusdan 2017-11-29 17:05:09 +01:00 cometido por GitHub
pare 5b811b719d
commit 26baa3b1b1
No se encontró ninguna clave conocida en la base de datos para esta firma
ID de clave GPG: 4AEE18F83AFDEB23

Veure arxiu

@ -1190,7 +1190,7 @@ class Mastodon:
raise MastodonAPIError('Endpoint not found.') raise MastodonAPIError('Endpoint not found.')
if isinstance(response, dict) and 'error' in response: if isinstance(response, dict) and 'error' in response:
raise MastodonAPIError("Mastodon API returned error: " + str(response['error'])) raise MastodonAPIError("Mastodon API returned error: " + response['error'].encode('utf-8').strip())
else: else:
raise MastodonAPIError('Endpoint not found.') raise MastodonAPIError('Endpoint not found.')