This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
[![Build Status](http://img.shields.io/travis/emotionLoop/visualCaptcha-python.svg?flat=true)](http://travis-ci.org/emotionLoop/visualCaptcha-python)
[![Coverage Status](https://coveralls.io/repos/emotionLoop/visualCaptcha-python/badge.svg?flat=true)](https://coveralls.io/r/emotionLoop/visualCaptcha-python)
[![Codacy](https://www.codacy.com/project/badge/528e5e89596e4bfb8a17292da017db4c)](https://www.codacy.com/app/bruno-bernardino/visualCaptcha-python)
[![Code Climate](https://codeclimate.com/github/emotionLoop/visualCaptcha-python/badges/gpa.svg)](https://codeclimate.com/github/emotionLoop/visualCaptcha-python)

# visualCaptcha-python

Python package for visualCaptcha's backend service


## Installation with PIP

You need Python installed with pip.
```
pip install visualcaptcha
```

## Run tests

Run next command to run unit tests:
```
python test.py
```

## Usage

### Initialization

On initialization visualCaptcha function requires a `Session` session object as first argument:

```python
from visualcaptcha import Session, Captcha
visualCaptcha = Captcha( Session(session) )
# Optional arguments: visualCaptcha = Captcha( Session(session, namespace), assetsPath, defaultImages, defaultAudios )
```

Where:

- `session` is a required shared session object, where correct and option values are stored for later verification in the backend
- `namespace` is an optional argument. Defaults to `'visualcaptcha'` and you can use it to use more than one visualCaptcha in the same page
- `assetsPath` is an optional argument. Defaults to the full path of `'./assets'`.
- `defaultImages` is an optional parameter. Defaults to the array inside of `./assets/images.json`. The `path` key is relative to `./assets/images/`
- `defaultAudios` is an optional parameter. Defaults to the array inside of `./assets/audios.json`. The `path` key is relative to `./assets/audios/`

### visualCaptcha.Captcha attributes

- `session`, `Session` object — An object that will have a reference for the session object.
It will have the following keys inside `visualCaptcha` key: `images`, `audios`, `validImageOption`, and `validAudioOption`.

- `imageOptions`, list — All the image options.
These can be easily overwritten with `defaultImages` when initializing `Captcha`.
By default, they're populated using the `./assets/images.json` file.

- `audioOptions`, list — All the audio options.
These can be easily overwritten with `defaultAudios` when initializing `Captcha`.
By default, they're populated using the `./assets/audios.json` file.

### visualCaptcha.Captcha methods

- `generate: ( self, numberOfOptions = 5 )` — Generate a new valid visualCaptcha front-end data. `numberOfOptions` — is an optional parameter for the number of generated images, defaults to `5`.
- `getFrontendData: ( self )` — Get data to be used by the frontend.
- `getValidImageOption: ( self )` — Get the current validImageOption.
- `getValidAudioOption: ( self )` — Get the current validAudioOption.
- `validateImage: ( self, sentOption )` — Validate the sent image value (sentOption) with the validImageOption.
- `validateAudio: ( self, sentOption )` — Validate the sent audio value (sentOption) with the validAudioOption.
- `getImageOptions: ( self )` — Return generated image options.
- `getImageOptionAtIndex: ( self, index )` — Return generated image option at given index.
- `getAudioOption: ( self ) ` — Alias for getValidAudioOption.
- `getAllImageOptions: ( self )` — Return all the image options.
- `getAllAudioOptions: ( self )` — Return all the audio options.
- `streamAudio: ( self, headers, fileType = 'mp3' )` — Stream audio file. Parameters:
- `headers` is a list with the HTTP headers to be set;
- `fileType` is the audio filetype, defaults to `'mp3'`, and it can also be `'ogg'`.
- `streamImage: ( self, headers, index, isRetina = False )` — Stream image file at given index for generated options. Parameters:
- `headers` is a list with the HTTP headers to be set;
- `index` is index of the image in the session images list to receive;
- `isRetina`, boolean, deciding if the normal or retina image should be streamed, defaults to `False`.

## Pushing to PyPi

`$ python setup.py sdist upload`


## License

View the [LICENSE](LICENSE.txt) file.
Release History

Release History

0.0.6

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
visualcaptcha-0.0.6.tar.gz (604.4 kB) Copy SHA256 Checksum SHA256 Source Jul 12, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting