mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Merge pull request #10016 from froggleston/feat/clients
Add support for requests pool size configuration
This commit is contained in:
commit
95fe0d5d82
|
@ -21,10 +21,19 @@ logger = logging.getLogger("ft_rest_client")
|
||||||
|
|
||||||
class FtRestClient:
|
class FtRestClient:
|
||||||
|
|
||||||
def __init__(self, serverurl, username=None, password=None):
|
def __init__(self, serverurl, username=None, password=None,
|
||||||
|
pool_connections=10, pool_maxsize=10):
|
||||||
|
|
||||||
self._serverurl = serverurl
|
self._serverurl = serverurl
|
||||||
self._session = requests.Session()
|
self._session = requests.Session()
|
||||||
|
|
||||||
|
# allow configuration of pool
|
||||||
|
adapter = requests.adapters.HTTPAdapter(
|
||||||
|
pool_connections=pool_connections,
|
||||||
|
pool_maxsize=pool_maxsize
|
||||||
|
)
|
||||||
|
self._session.mount('http://', adapter)
|
||||||
|
|
||||||
self._session.auth = (username, password)
|
self._session.auth = (username, password)
|
||||||
|
|
||||||
def _call(self, method, apipath, params: Optional[dict] = None, data=None, files=None):
|
def _call(self, method, apipath, params: Optional[dict] = None, data=None, files=None):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user