Skip to content

Commit

Permalink
Merge pull request #96 from SEKOIA-IO/fix/AsyncConnector
Browse files Browse the repository at this point in the history
Async: Fix arguments for AsyncConnector
  • Loading branch information
squioc authored Nov 20, 2023
2 parents 32f4f70 + 1021214 commit 221498e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Fix the initializer arguments for AsyncConnector

## [1.8.0] - 2023-11-13

### Added
Expand Down
15 changes: 13 additions & 2 deletions sekoia_automation/aio/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
from collections.abc import AsyncGenerator
from contextlib import asynccontextmanager
from datetime import datetime
from pathlib import Path
from urllib.parse import urljoin

from aiohttp import ClientSession
from aiolimiter import AsyncLimiter

from sekoia_automation.connector import Connector, DefaultConnectorConfiguration
from sekoia_automation.module import Module


class AsyncConnector(Connector, ABC):
Expand All @@ -22,16 +24,25 @@ class AsyncConnector(Connector, ABC):
_session: ClientSession | None = None
_rate_limiter: AsyncLimiter | None = None

def __init__(self, event_loop: AbstractEventLoop | None = None, *args, **kwargs):
def __init__(
self,
module: Module | None = None,
data_path: Path | None = None,
event_loop: AbstractEventLoop | None = None,
*args,
**kwargs,
):
"""
Initialize AsyncConnector.
Optionally accepts event_loop to use, otherwise will use default event loop.
Args:
module: Module | None
data_path: Path | None
event_loop: AbstractEventLoop | None
"""
super().__init__(*args, **kwargs)
super().__init__(module=module, data_path=data_path, *args, **kwargs)

self._event_loop = event_loop or get_event_loop()

Expand Down

0 comments on commit 221498e

Please sign in to comment.