Skip to content

A library and web service for validating if a given string contains all 26 letters of the English language

Notifications You must be signed in to change notification settings

jlivermont/stringer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CircleCI

All Letters Validator

The all letters library and web service can determine whether a given string contains all 26 English letters (a-z) regardless of case.

Setup

Install all dependencies by running pip install -r requirements.txt in the top-level project directory.

Running the Service Locally

The validator service can be started by running gunicorn --access-logfile - stringer:app

Building and Running a Docker Container

A Docker container for this service can be generated by running docker build .. After an image is successfully built, the image can be started by running docker run -it -P <container-id>.

Example Service Usage

Here is an example request to the service:

$ curl -X POST -H 'Content-Type: application/json' --data '{"string": "abc"}' 'http://127.0.0.1:8000/all-letters-validator'
{"result": "fail"}
$ curl -X POST -H 'Content-Type: application/json' --data '{"string": "abcdefghijklmnopqrstuvwxyz"}' 'http://127.0.0.1:8000/all-letters-validator'
{"result": "pass"}
curl -X POST -H 'Content-Type: application/json' --data '{"string": "abcdefghijklmnopqrstuvwxyz @@ !! ??   ....  +++ ----"}' 'http://127.0.0.1:8000/all-letters-validator'
{"result": "pass"}

Direct Usage

Here's how to use the all letters validator directly:

>>> from app.validators.all_letters import AllLettersValidator
>>> v = AllLettersValidator()
>>> v.validate("abcdefghijklmnopqrstuvwxyz")
True
>>> v.validate("string")
False

Tests

You can execute unit tests by running pytest ./test/unit from the top-level project directory. You can execute acceptance tests by running pytest ./test/acceptance from the top-level project directory.

About

A library and web service for validating if a given string contains all 26 letters of the English language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published