Skip to content

Commit baaa2e5

Browse files
committed
More on README
1 parent 216d179 commit baaa2e5

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

README.rst

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,52 @@ A captcha library that generates audio and image CAPTCHAs.
99
:target: https://ci.appveyor.com/project/lepture/captcha
1010
.. image:: https://coveralls.io/repos/lepture/captcha/badge.png?branch=master
1111
:target: https://coveralls.io/r/lepture/captcha
12+
13+
14+
Features
15+
--------
16+
17+
1. Audio CAPTCHAs
18+
2. Image CAPTCHAs
19+
20+
Installation
21+
------------
22+
23+
Install captcha with pip::
24+
25+
$ pip install captcha
26+
27+
Usage
28+
-----
29+
30+
Audio and Image CAPTCHAs are in seprated modules::
31+
32+
from io import BytesIO
33+
from captcha.audio import AudioCaptcha
34+
from captcha.image import ImageCaptcha
35+
36+
audio = AudioCaptcha(voicedir='/path/to/voices')
37+
image = ImageCaptcha(fonts=['/path/A.ttf', '/path/B.ttf'])
38+
39+
data = audio.generate('1234')
40+
assert isinstance(data, bytearray)
41+
audio.write('1234', 'out.wav')
42+
43+
data = image.generate('1234')
44+
assert isinstance(data, BytesIO)
45+
image.write('1234', 'out.png')
46+
47+
This is the APIs for your daily works. We do have built-in voice data and font
48+
data. But it is suggested that you use your own voice and font data.
49+
50+
51+
Contribution
52+
------------
53+
54+
We need voice wav files. The voice wav file should be in 8-bit, please keep it
55+
as small as possible. Name your voice file as::
56+
57+
{{language}}-{{character}}-{{username}}.wav
58+
# exmaple: zh-1-lepture.wav
59+
60+
TODO: we need a place to upload voice files.

0 commit comments

Comments
 (0)