diff --git a/binance/async_client.py b/binance/async_client.py index a82b9cf8..bd37cfe9 100644 --- a/binance/async_client.py +++ b/binance/async_client.py @@ -4,6 +4,7 @@ from urllib.parse import urlencode import time import aiohttp +import yarl from binance.enums import HistoricalKlinesType from binance.exceptions import ( @@ -103,8 +104,13 @@ async def _request( ): kwargs = self._get_request_kwargs(method, signed, force_params, **kwargs) + if method == 'get': + # url encode the query string + uri = f"{uri}?{kwargs['params']}" + kwargs.pop('params') + async with getattr(self.session, method)( - uri, proxy=self.https_proxy, **kwargs + yarl.URL(uri, encoded=True), proxy=self.https_proxy, **kwargs ) as response: self.response = response return await self._handle_response(response)