Skip to content

Commit

Permalink
feat: temp detector
Browse files Browse the repository at this point in the history
  • Loading branch information
krypton-byte committed Aug 10, 2022
1 parent 04eab1d commit 2104e9d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion xtempmail/aiomail.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from typing import Awaitable, Callable, Union, Optional, Any
import httpx
from random import randint
from .utils import log, Extension, EMAIL, err_code, extension
from .utils import Extension, EMAIL, err_code, extension
from .logger import log
from .error import (
Parameters,
InvalidPIN,
Expand Down
4 changes: 4 additions & 0 deletions xtempmail/logger.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import logging
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
log = logging.getLogger('xtempmail')
log.setLevel(logging.WARNING)
8 changes: 1 addition & 7 deletions xtempmail/mail.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations
from inspect import signature
import logging
from io import BytesIO
from random import randint
import time
Expand All @@ -21,12 +20,7 @@
Extension,
extension
)
author = "krypton-byte"
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
log = logging.getLogger('xtempmail')
log.setLevel(logging.WARNING)
# log=logging.getLogger('xtempmail')
# log.setLevel(logging.INFO)
from .logger import log


class event:
Expand Down
16 changes: 12 additions & 4 deletions xtempmail/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import logging
from __future__ import annotations
from enum import Enum
from typing import Union
from .error import (
InvalidPIN
)
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.INFO)
log = logging.getLogger('xtempmail')
log.setLevel(logging.WARNING)


def err_code(c: int):
Expand All @@ -28,6 +26,16 @@ class EMAIL(Enum):
def apply(self, name: str) -> str:
return name + '@' + self.value

@classmethod
def istemp(cls, email: Union[str, Extension]):
mail = email.ex[1:] if isinstance(
email, Extension) else (
email.split('@')[email.split('@').__len__() == 2])
for e in cls.__members__.values():
if e.value == mail:
return True
return False


class Extension:
def __init__(self, ex: str):
Expand Down

0 comments on commit 2104e9d

Please sign in to comment.