Initial Source code version
This commit is contained in:
parent
90f5f38812
commit
d979374cbc
23 changed files with 2628 additions and 0 deletions
22
app/workers/mail_spf_worker.py
Normal file
22
app/workers/mail_spf_worker.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import asyncio
|
||||
from app.workers.base_worker import BaseWorker
|
||||
from app.job_registry import routing_key
|
||||
from app.workers.utils import resolve_txt, parse_spf
|
||||
|
||||
class SPFValidationWorker(BaseWorker):
|
||||
async def process(self, payload: dict, **meta) -> dict:
|
||||
domain = payload.get("domain")
|
||||
if not domain:
|
||||
raise ValueError("payload.domain is required")
|
||||
txts = await resolve_txt(domain)
|
||||
parsed = parse_spf(txts)
|
||||
await asyncio.sleep(0)
|
||||
return parsed
|
||||
|
||||
async def main():
|
||||
worker = SPFValidationWorker(routing_key("MailCheck", "SPFValidation"), worker_id="spf-worker-1")
|
||||
await worker.run()
|
||||
|
||||
if __name__ == "__main__":
|
||||
import asyncio as _a
|
||||
_a.run(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue