https://github.com/torshin5ergey/phone-validator-api
https://github.com/torshin5ergey/phone-validator-api
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/torshin5ergey/phone-validator-api
- Owner: torshin5ergey
- Created: 2025-04-02T13:59:57.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-02T18:18:15.000Z (6 months ago)
- Last Synced: 2025-04-02T19:21:54.703Z (6 months ago)
- Language: Python
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Phone Validator API
## References
- [Quickstart — Flask Documentation (3.1.x)](https://flask.palletsprojects.com/en/stable/quickstart/)
- [Задачи квалификации чемпионата по программированию 2019 среди бэкенд-разработчиков. G Сервис валидации телефонных номеров](https://yandex.ru/cup/backend/analysis#)## App
1. Install requirements
```bash
pip install -r requirements
```
2. Run app
```bash
python3 app.py
```
3. Use app
```bash
# ping
curl localhost:7777/ping# shutdown
curl localhost:7777/shutdown# validatePhoneNumber
# valid phone
curl -X POST -d "+7 982 123 4567" http://localhost:7777/validatePhoneNumber
# invalid phone
curl -X POST -d "12345" http://localhost:7777/validatePhoneNumber
```## Run with Docker
1. Create image
```bash
docker build -t phone-validator-api .
```
2. Run container
```bash
docker run -p 7777:7777 -d phone-validator-api
```
3. Use app
```bash
# ping
curl localhost:7777/ping# shutdown
curl localhost:7777/shutdown# validatePhoneNumber
# valid phone
curl -X POST -d "+7 982 123 4567" http://localhost:7777/validatePhoneNumber
# invalid phone
curl -X POST -d "12345" http://localhost:7777/validatePhoneNumber
```## Tests
Run tests
```bash
# simple run
pytest -v# run with test cover report
pytest -v --cov=app# run with test cover report in html
# htmlcov directory
pytest -v -cov=app --cov-report=html
```## Author
Sergey Torshin [@torshin5ergey](https://github.com/torshin5ergey)