(k: int, *, img_width: int = 100, img_height: int = 50, font_sizes:List[int] = None)
| 30 | |
| 31 | |
| 32 | def create_code(k: int, *, img_width: int = 100, img_height: int = 50, font_sizes:List[int] = None): |
| 33 | if not font_sizes: |
| 34 | font_sizes = [35, 30, 33] |
| 35 | elif isinstance(font_sizes, int): |
| 36 | font_sizes = [font_sizes] |
| 37 | image = ImageCaptcha(width=img_width, height=img_height, font_sizes=font_sizes) |
| 38 | codes = ''.join(random.choices(WORDS, k=k)) |
| 39 | captcha_img = image.generate(codes) |
| 40 | return captcha_img.read(), codes |
| 41 | |
| 42 | |
| 43 | def create_base64_code(k: int, *, img_width: int = 100, img_height: int = 50, font_sizes:List[int] = None): |
no outgoing calls
no test coverage detected