mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
- [Aiohttp Custom Session Connector](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# pip install aiohttp_socks
|
||||
|
||||
import asyncio
|
||||
import ccxt.async_support as ccxt
|
||||
import aiohttp
|
||||
import aiohttp_socks
|
||||
|
||||
async def test():
|
||||
|
||||
connector = aiohttp_socks.ProxyConnector.from_url('socks5://user:password@127.0.0.1:1080')
|
||||
session = aiohttp.ClientSession(connector=connector)
|
||||
|
||||
exchange = ccxt.binance({
|
||||
'session': session,
|
||||
# ...
|
||||
})
|
||||
|
||||
# ...
|
||||
|
||||
await exchange.close() # Close the exchange
|
||||
await session.close() # don't forget to close the session
|
||||
|
||||
# ...
|
||||
|
||||
asyncio.run(test())
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user