Skip to content

Commit

Permalink
Merge pull request #8 from ninoseki/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
ninoseki committed Jul 22, 2023
2 parents 58df044 + 07ba2c3 commit e4ec827
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 12 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish package

on:
release:
types: ["created"]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Setup Poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: 1.5.1

- name: Install plugin
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: Set PyPI token
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry config pypi-token.pypi $PYPI_TOKEN

- name: Build and publish
run: poetry publish --build
13 changes: 4 additions & 9 deletions aiodnsbl/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def is_ip_address(value: str) -> bool:
@functools.lru_cache(maxsize=256)
def normalize_domain(value: str) -> str:
value = value.lower()

return idna.encode(value).decode()


Expand Down Expand Up @@ -134,21 +133,17 @@ async def check_async(self, request: str) -> DNSBLResult:
if provider.support_type == request_type:
selected_providers.append(provider)

tasks = []
for provider in selected_providers:
tasks.append(self.dnsbl_request(request, provider))

tasks = [
self.dnsbl_request(request, provider) for provider in selected_providers
]
responses = await asyncio.gather(*tasks)
return DNSBLResult(address=request, responses=responses)

async def check(self, request: str) -> DNSBLResult:
return await self.check_async(request)

async def bulk_check(self, requests: List[str]) -> List[DNSBLResult]:
tasks = []
for request in requests:
tasks.append(self.check_async(request))

tasks = [self.check_async(request) for request in requests]
return await asyncio.gather(*tasks)


Expand Down
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ readme = "README.md"

[tool.poetry.dependencies]
python = "^3.8.1"
aiodns = "^3.0.0"
idna = "^3.4"
aiodns = ">=3.0,<4.0"
idna = ">=3.4,<4.0"

[tool.poetry.group.dev.dependencies]
autoflake = "^2.2"
Expand Down

0 comments on commit e4ec827

Please sign in to comment.