(self)
| 116 | await self.close() |
| 117 | |
| 118 | def open(self): |
| 119 | if self.asyncio_loop is None: |
| 120 | if sys.version_info >= (3, 7): |
| 121 | self.asyncio_loop = asyncio.get_running_loop() |
| 122 | else: |
| 123 | self.asyncio_loop = asyncio.get_event_loop() |
| 124 | self.throttler.loop = self.asyncio_loop |
| 125 | |
| 126 | if self.ssl_context is None: |
| 127 | # Create our SSL context object with our CA cert file |
| 128 | self.ssl_context = ssl.create_default_context(cafile=self.cafile) if self.verify else self.verify |
| 129 | if (self.ssl_context and self.safe_bool(self.options, 'include_OS_certificates', False)): |
| 130 | os_default_paths = ssl.get_default_verify_paths() |
| 131 | if os_default_paths.cafile and os_default_paths.cafile != self.cafile: |
| 132 | self.ssl_context.load_verify_locations(cafile=os_default_paths.cafile) |
| 133 | |
| 134 | if self.own_session and self.session is None: |
| 135 | # Pass this SSL context to aiohttp and create a TCPConnector |
| 136 | self.tcp_connector = aiohttp.TCPConnector(ssl=self.ssl_context, loop=self.asyncio_loop, enable_cleanup_closed=True) |
| 137 | self.session = aiohttp.ClientSession(loop=self.asyncio_loop, connector=self.tcp_connector, trust_env=self.aiohttp_trust_env) |
| 138 | |
| 139 | async def close(self, clean_instance_data=False): |
| 140 | # ##### language-specific cleanup of WS & REST resources ##### |
no test coverage detected