<commit_before># SMS Authorization Microservice
The SMS Authorization microservice is a service that allows you to create an authorization code and expiration date, and then sent by SMS to a specified recipient. 
## About the Authorization Microservice

The project contains a Flask app serving up a single resource at the site base.
The service uses a SQLite backend.

The authorization code, expiration date, and number of retries are user-defined within **settings.py**.

The microservice uses two methods: POST and GET. POST generates the authorization code, expiration date, code length, and retries. GET then validates the data and either returns a success message or an error exception. 

###Before you install the service

A **credential.py** file is required at the application level that includes your Access Key, Secret Key, and your Flowroute number enabled for SMS. If you do not know this information, you can find them on the [Flowroute](https:https://manage.flowroute.com) portal. 

The following lines should be added to the **credential.py** file:

	FLOWROUTE_ACCESS_KEY = "Your Access Key"

	FLOWROUTE_SECRET_KEY = "Your Secret Key"

	FLOWROUTE_NUMBER = "Your Flowroute phone number"
## Installing the service

The application contains a code-generation function whose length is configurable from **settings.py**. The function can be configured to allow a specific number of retries as well as an expiration date.

The company name that appears in the SMS content can be set via settings.py

>**Note:** During development DEBUG\_MODE should be set to `True` to use a test database. Testing can be performed on this database, which refreshes data in the tables each time. Once the development cycle is over, set DEBUG\_MODE to `FALSE` in order to use the production database. Tests cannot be peformed on the production database.  

Deploying the service can be done either by running the setup using Docker or by running the application locally with Flask's built-in web server

#####To run the application using Docker:	

1.	Run the folowing to build the service at the top level of the project:

		$ docker build -t sms_auth_api .

2. Next, run the followig:

		$ docker run -p 8000:8000 sms_auth_api
	
	This starts four gunicorn workers listening on the port 8080 of the Docker system. This information is defined in the `entry` script.


#####To run the application using Flask:

1.	Run the following to install the service dependencies at the root level of the project:

		pip install .

2. Next, run the following:
		
		python -m sms_auth_service.api
	
	The service is set up at the root level.
	
>**Note:** See the [Flask](a href="http://flask.pocoo.org/") documentation for more information about the web framework.

##Configure the authorization setings
Authorization settings can be configured using one of two methods: Update the **settings.py** file or use **client.py**.

###settings.py
**settings.py** allows you to customize the authorization parameters, including authorization code length, expiration, number of retries, and company name. 

#####To configure the authorization settings:

1. Open **settings.py**.
<commit_msg>WIP: README.md<commit_after># SMS Authorization Microservice
The SMS Authorization microservice is a service that allows you to create an authorization code and expiration date, and then sent by SMS to a specified recipient. 
## About the Authorization Microservice

The project contains a Flask app serving up a single resource at the site base.
The service uses a SQLite backend.

The authorization code, expiration date, and number of retries are user-defined within **settings.py**.

The microservice uses two methods: POST and GET. POST generates the authorization code, expiration date, code length, and retries. GET then validates the data and either returns a success message or an error exception. 

###Before you install the service

A **credential.py** file is required at the application level that includes your Access Key, Secret Key, and your Flowroute number enabled for SMS. If you do not know this information, you can find them on the [Flowroute](https:https://manage.flowroute.com) portal. 

The following lines should be added to the **credential.py** file:

	FLOWROUTE_ACCESS_KEY = "Your Access Key"

	FLOWROUTE_SECRET_KEY = "Your Secret Key"

	FLOWROUTE_NUMBER = "Your Flowroute phone number"
## Installing the service

The application contains a code-generation function whose length is configurable from **settings.py**. The function can be configured to allow a specific number of retries as well as an expiration date.

The company name that appears in the SMS content can be set via settings.py

>**Note:** During development DEBUG\_MODE should be set to `True` to use a test database. Testing can be performed on this database, which refreshes data in the tables each time. Once the development cycle is over, set DEBUG\_MODE to `FALSE` in order to use the production database. Tests cannot be peformed on the production database.  

Deploying the service can be done either by running the setup using Docker or by running the application locally with Flask's built-in web server

#####To run the application using Docker:	

1.	Run the folowing to build the service at the top level of the project:

		$ docker build -t sms_auth_api:0.0.1 .

-t tags the image allowing you to reference it.

2. Next, run the following:

		$ docker run -p 8000:8000 sms_auth_api:0.0.1
	
	-p binds the container port to the host port. You cannot have multiple applications listening on the same port.
	
###	Test the application 
	
	This starts four gunicorn workers listening on the port 8080 of the Docker system. This information is defined in the `entry` script.

the entry script takes the last command that was passed from the `run` command. Unit testing. Won't run if debug is false.

	$ docker run -p 8000:8000 sms_auth_api:0.0.1 test


#####To run the application using Flask:

1.	Run the following to install the service dependencies at the root level of the project:

		pip install .

2. Next, run the following:
		
		python -m sms_auth_service.api
	
	The service is set up at the root level.
	
>**Note:** See the [Flask](a href="http://flask.pocoo.org/") documentation for more information about the web framework.

##Configure the authorization setings
Authorization settings can be configured using one of two methods: Update the **settings.py** file or use **client.py**.

###settings.py
**settings.py** allows you to customize the authorization parameters, including authorization code length, expiration, number of retries, and company name. 

#####To configure the authorization settings:

1. Open **settings.py**.

{'fraction_non_alphanumeric': 0.06147418680990749, 'fraction_numerical': 0.007609668755595345, 'mean_word_length': 4.401289282836422, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1705350', 'n_tokens_mistral': 1802, 'n_tokens_neox': 1663, 'n_words': 971}