github
254 of 321 new or added lines in 21 files covered. (79.13%)
254 of 321 relevant lines covered (79.13%)
2.36 hits per line
NEW
|
import json |
× |
2 |
|
|
NEW
|
import typer |
× |
4 |
|
|
NEW
|
from . import get_abuse_contacts
|
× |
NEW
|
from .errors import InvalidAddressError |
× |
NEW
|
from .schemas.contact import Contacts |
× |
8 |
|
|
NEW
|
app = typer.Typer() |
× |
10 |
|
|
11 |
|
|
NEW
|
@app.command()
|
× |
NEW
|
def whois( |
× |
14 |
address: str = typer.Argument(..., help="URL, domain, IP address or email address")
|
|
15 |
): |
|
NEW
|
try:
|
× |
NEW
|
contacts = get_abuse_contacts(address) |
× |
NEW
|
schema = Contacts.from_orm(contacts) |
× |
NEW
|
print(schema.json(by_alias=True)) # noqa: T001 |
× |
NEW
|
except InvalidAddressError as e: |
× |
NEW
|
print(json.dumps({"error": str(e)})) # noqa: T001 |
× |
22 |
|
|
23 |
|
|
NEW
|
if __name__ == "__main__": |
× |
NEW
|
app() |
× |