Skip to content

Vizonex/AnyioTyper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AnyioTyper

Wraps In Typer with Anyio, unlike Async-Typer AnyioTyper's goal is to allow customization with different eventloops

from anyio_typer import AnyioTyper, Option
from typing import Annotated
app = AnyioTyper()

# This example uses a library called cyares you can install it with `pip install cyares`

# NOTE: winloop is supported by default if your on a windows operating system
@app.uvloop_command()
async def uvloop(
    host:str,
    rt:Annotated[str, Option(help="A Type of record to uncover", show_default=True)] = "A" 
    ):
    """Use Uvloop or Winloop for DNS Resolving"""
    
    from cyares.aio import DNSResolver

    async with DNSResolver(["8.8.8.8", "8.8.4.4"]) as resolver:
        result = await resolver.query(host, rt)
    print(result)

@app.trio_command()
async def trio(
    host:str,
    rt:Annotated[str, Option(help="A Type of record to uncover", show_default=True)] = "A" 
    ):
    """Use Trio for DNS Resolving"""
    from cyares.trio import DNSResolver

    async with DNSResolver(["8.8.8.8", "8.8.4.4"]) as resolver:
        result = await resolver.query(host, rt)
    print(result)


if __name__ == "__main__":
    app()

About

A Commandline tool that combines anyio with typer to create a asynchronous commandline.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages