Skip to content

Commit

Permalink
Merge pull request #4 from ninoseki/v0.1.1
Browse files Browse the repository at this point in the history
V0.1.1
  • Loading branch information
ninoseki committed Dec 3, 2021
2 parents 353a0cf + 6fe72fe commit 1cd32f2
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 47 deletions.
2 changes: 1 addition & 1 deletion abuse_whois/__init__.py
Expand Up @@ -4,8 +4,8 @@
from abuse_whois.matchers.shared_hosting import get_shared_hosting_provider
from abuse_whois.matchers.whois import get_contact_from_whois

from .dataclasses import Contact, Contacts
from .errors import InvalidAddressError
from .schemas import Contact, Contacts
from .utils import get_hostname, is_domain, is_ip_address, is_supported_address

try:
Expand Down
4 changes: 1 addition & 3 deletions abuse_whois/api/endpoints/whois.py
Expand Up @@ -9,8 +9,6 @@
@router.post("/", response_model=schemas.Contacts)
def whois(query: schemas.Query):
try:
contacts = get_abuse_contacts(query.address)
return get_abuse_contacts(query.address)
except InvalidAddressError as e:
raise HTTPException(400, detail=str(e))

return schemas.Contacts.from_orm(contacts)
4 changes: 1 addition & 3 deletions abuse_whois/cli.py
Expand Up @@ -4,7 +4,6 @@

from . import get_abuse_contacts
from .errors import InvalidAddressError
from .schemas.contact import Contacts

app = typer.Typer()

Expand All @@ -15,8 +14,7 @@ def whois(
):
try:
contacts = get_abuse_contacts(address)
schema = Contacts.from_orm(contacts)
print(schema.json(by_alias=True)) # noqa: T001
print(contacts.json(by_alias=True)) # noqa: T001
except InvalidAddressError as e:
print(json.dumps({"error": str(e)})) # noqa: T001

Expand Down
37 changes: 0 additions & 37 deletions abuse_whois/dataclasses.py

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "abuse_whois"
version = "0.1.0"
version = "0.1.1"
description = "Find where to report a domain for abuse"
authors = ["Manabu Niseki <manabu.niseki@gmail.com>"]
license = "MIT"
Expand Down
4 changes: 2 additions & 2 deletions tests/matchers/shared_hosting/test_rule.py
Expand Up @@ -2,8 +2,8 @@

import pytest

from abuse_whois.dataclasses import Contact
from abuse_whois.matchers.shared_hosting.rule import SharedHostingRule
from abuse_whois.schemas import Contact


@pytest.mark.parametrize(
Expand All @@ -17,7 +17,7 @@
],
)
def test_match(hostname: str, base_domains: List[str], expected: bool):
contact = Contact("test", "test")
contact = Contact(provider="test", address="test")
base = SharedHostingRule(contact=contact, base_domains=base_domains)

assert base.match(hostname) is expected

0 comments on commit 1cd32f2

Please sign in to comment.