Esempio n. 1
0
def main():
    project_name = "demo"
    with open("configs/%s.json" % project_name, encoding="utf-8") as fp:
        demo_config = json.load(fp)

    demo_factory = CaptchaFactory(char_custom_fns=[char_custom_fn], bg_custom_fns=[bg_custom_fn], **demo_config)
    index =20
    while index:
        captcha = demo_factory.generate_captcha()
        captcha.save("output/%s/%s.jpg" % (project_name, captcha.text))
        # print(captcha.text, captcha.num)

        index -= 1
Esempio n. 2
0
def main():
    project_name = "jingdong"
    with open("configs/%s.json" % project_name, encoding="utf-8") as fp:
        demo_config = json.load(fp)

    demo_factory = CaptchaFactory(char_custom_fns=[custom_fn],
                                  bg_custom_fns=[bg_custom_fn],
                                  **demo_config)
    number = 3
    while number:
        # captcha = demo_factory.generate_captcha(specific_chars=specific)
        captcha = demo_factory.generate_captcha()
        captcha.save("output/%s/%s.jpg" % (project_name, captcha.text))
        # for c in captcha.chars:
        #     print(c.char_text, c.color)
        print(captcha.text, captcha.num)

        number -= 1
def main():
    project_name = "58gua_kao"
    with open("configs/%s.json" % project_name, encoding="utf-8") as fp:
        demo_config = json.load(fp)

    demo_factory = CaptchaFactory(char_custom_fns=[char_custom_fn],
                                  bg_custom_fns=[bg_custom_fn],
                                  **demo_config)
    index = 3
    while index:
        # text = generate_phone_number(index)
        text = generate_mobile_number(index)

        captcha = demo_factory.generate_captcha(text=text)
        captcha.save("output/%s/%s.jpg" % (project_name, captcha.text))
        print(captcha.text, captcha.num)

        index -= 1
Esempio n. 4
0
def main():
    project_name = "icp"
    with open("configs/icp.json", encoding="utf-8") as fp:
        demo_config = json.load(fp)

    # with open("configs/char/specific_chars.json", encoding="utf-8") as fp:
    #     specific = json.load(fp)

    demo_factory = CaptchaFactory(char_custom_fns=[custom_fn],
                                  bg_custom_fns=[bg_custom_fn],
                                  **demo_config)
    number = 3
    while number:
        # captcha = demo_factory.generate_captcha(specific_chars=specific)
        captcha = demo_factory.generate_captcha()
        captcha.save("output/%s/%s.jpg" % (project_name, captcha.text))
        print(captcha.text, captcha.num)

        number -= 1