Do not encode pictures as utf-8
This commit is contained in:
parent
f02aa38200
commit
74079fb481
@ -14,7 +14,7 @@ __author__ = "Davide Testa"
|
|||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
__credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "2.3.3"
|
__version__ = "2.3.4"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ async def async_request(url, type='get', mode='json', encoding='utf-8',
|
|||||||
* html
|
* html
|
||||||
* json
|
* json
|
||||||
* string
|
* string
|
||||||
|
* picture
|
||||||
|
|
||||||
Additional **kwargs may be passed.
|
Additional **kwargs may be passed.
|
||||||
"""
|
"""
|
||||||
@ -182,7 +183,8 @@ async def async_request(url, type='get', mode='json', encoding='utf-8',
|
|||||||
else s.post(url, timeout=30, data=kwargs)
|
else s.post(url, timeout=30, data=kwargs)
|
||||||
) as r:
|
) as r:
|
||||||
result = await r.read()
|
result = await r.read()
|
||||||
result = result.decode(encoding)
|
if mode in ['html', 'json', 'string']:
|
||||||
|
result = result.decode(encoding)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(
|
logging.error(
|
||||||
'Error making async request to {}:\n{}'.format(
|
'Error making async request to {}:\n{}'.format(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user