verify_email
verify_email copied to clipboard
Doesn't work with FastApi already running eventloop
File "/usr/local/lib/python3.9/site-packages/verify_email/verify_email.py", line 106, in verify_email resp = loop.run_until_complete(_verify_email(email, timeout, verify))
RuntimeError: this event loop is already running.
CODE:
if not await verify_email(email):
raise HTTPException(status_code=HTTP_403_FORBIDDEN, detail="Invalid Email")
Hi @syleishere, I'm curious if you can use it like shown in https://github.com/kakshay21/verify_email/blob/1b641d2867d1c7198b2cf46e21bc75737dcad273/examples.py#L39 Otherwise, let me know, I'll try to find some other workaround for this. Thanks!
Or if you're not using bulk email verify then this should work for you: https://github.com/kakshay21/verify_email/blob/1b641d2867d1c7198b2cf46e21bc75737dcad273/verify_email/verify_email.py#L77
It wouldn't work, I have already fought with getting aiomysql working in fastapi. Issue is there is only one way to get access to eventloop with it, and that's with a startup function they created. So unless plugin comes with some initialization code to call, it would have to be integrated right in. I learned they do have an email validation tag, so I have resorted to using that instead.
I think if you really wanted to support it for future plugins you'd have to do something like aiomysql does, it has a feature to grab current running eventloop instead of defaulting to their own.
If you face same problem, use validate_email. It works perfectly without error. link. https://pypi.org/project/validate_email/
Can you guys try the 2.4.4 version and see if it works?
pip3 install verify-email==2.4.4.dev0
2.4.4.dev0 it does not work neither :(
@jorgeroman can you try this? https://github.com/kakshay21/verify_email/issues/48#issuecomment-1685262024 feel free to reopen this issue if that doesn't work out.