Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix OSError issues #23

Merged
merged 2 commits into from
Mar 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion brawlstats/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ class Client:
The ``event loop`` to use for asynchronous operations. Defaults to ``None``,
in which case the default event loop is used via ``asyncio.get_event_loop()``.
If you are passing in an aiohttp session, using this will not work. You must set it when initializing the session.
connector: Optional[aiohttp.TCPConnector]
Pass in a TCPConnector for the client. Defaults to ``None``,
If you are passing in an aiohttp session, using this will not work. You must set it when initializing the session.
debug: Optional[bool] = False
Whether or not to give you more info to debug easily.
base_url: Optional[str] = None
Expand All @@ -46,7 +49,10 @@ class Client:
def __init__(self, token, session=None, timeout=10, is_async=False, **options):
self.is_async = is_async
self.loop = options.get('loop', asyncio.get_event_loop())
self.session = session or (aiohttp.ClientSession(loop=self.loop) if self.is_async else requests.Session())
self.connector = options.get('connector')
self.session = session or (
aiohttp.ClientSession(loop=self.loop, connector=self.connector) if self.is_async else requests.Session()
)
self.timeout = timeout
self.api = API(options.get('base_url'))
self.debug = options.get('debug', False)
Expand Down