https://github.com/sgudkov/homework-20250217
https://github.com/sgudkov/homework-20250217
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sgudkov/homework-20250217
- Owner: Sgudkov
- Created: 2025-02-18T06:35:44.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-02-19T14:20:44.000Z (4 months ago)
- Last Synced: 2025-02-19T15:30:59.088Z (4 months ago)
- Language: Python
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Server
This is a simple API server written in Python. It provides two endpoints: `online_score` and `clients_interests`.
## Endpoints
### online_score
This endpoint calculates a score based on the provided data. It takes the following parameters:
* `phone`: phone number
* `email`: email address
* `birthday`: birthday in YYYY-MM-DD format
* `gender`: gender (0 - unknown, 1 - male, 2 - female)
* `first_name`: first name
* `last_name`: last nameIt returns a score as a JSON response.
### clients_interests
This endpoint returns the interests of a list of clients. It takes the following parameter:
* `client_ids`: a list of client IDs
* `date`: date in YYYY-MM-DD formatIt returns a list of interests as a JSON response.
## Setting up dependencies
To set up the dependencies, use the Makefile:
```bash
make setup
```## Running the Server
To run the server, use the Makefile:
```bash
make run
```
This will start the server on port 8080. You can specify a different port by using the -p flag:```bash
make run -p 8000
```
You can also run the server with logging enabled by specifying a log file:```bash
make run -l log.txt
```
This will write log messages to the specified file.## Testing the Server
To test the server, use the Makefile:
```bash
make test
```This will run the tests and generate a coverage report.