Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for async #49

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

blokje
Copy link

@blokje blokje commented Mar 23, 2021

We use an async approach to all of our API's. As such I took the liberty on creating an aiohttp equivalent of pyvat. Is this something to consider including into your code? If so, some more work has to be done in order to clean things up and remove redundant code. Otherwise we will just keep using it in our internal fork.

At this moment it works mostly as an drop-in replacement, except for the need to use async functions of course ;)

import asyncio
from pprint import pprint

async def aio_main():
    import pyvat.aio as pyvat
    x = await pyvat.check_vat_number('001786519B01', 'NL')
    pprint(vars(x))

def main():
    import pyvat
    x = pyvat.check_vat_number('001786519B01', 'NL')
    pprint(vars(x))

main()
asyncio.run(aio_main())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant