Skip to content

streethacker/pysvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PYSVM

Introduction

Simple picture verify code manager implemented by python.

Install

2 ways to install PYSVM

  1. clone the repo to your machine and run
$ python setup.py install
  1. using pip
$ pip install -e git+https://github.com/streethacker/pysvm@0.1#egg=pysvm

Try It!

Simply try PYSVM's functionality!

$ cd /your/path/to/pysvm
$ make test
$ python example/test.py

Then visit http://127.0.0.1:5000/retrieve from your webbrowser.

Quick Start

>>> from pysvm.svm import VerifyCodeManager
>>> manager = VerifyCodeManager()
>>> img_buf, img_hash = manager.verify_code_create()

More details, ref to __doc__

>>> print manager.__doc__

    Create verify code image.

    :param charset: Character collection in which verify code symbols choose
        from, default `CHARSET`.
    :param width: Width of the verify code picture, in pixels, default 120.
    :param height: Height of the verify code picture, in pixels, default 30.
    :param mode: Colour mode of the verify code picture, default 'RGB'.
    :param bg_color: A 3-elements tuple, containing (R, G, B) three integers
        which describes the background colour of the verify code picture.
    :param font_size: Font size of the verify code, default 22.
    :param font_face: Font face of the verify code, default 'Arial.ttf'.
    :param text_length: Length of characters which compose the verify code,
        default 4.
    :param noise_coverage: Probability of noise points, default 0.3.
    :param redis_dsn: Redis DSN(data source name), e.g.
        redis://[:password]@localhost:6379/0.
    :param ttl: Redis sotrage expiration time, count on seconds.
    :param max_try: Trials limit for verify code, if try counts exceeded, the
        current verify code would be expired, default 3.
    :param redis_factory: Factory function to create redis client.

>>>

About

Simple Verify Code Manager

Resources

Stars

Watchers

Forks

Packages

No packages published