https://github.com/noahgift/flask-change-microservice
Small Flask Microservice that makes the change
https://github.com/noahgift/flask-change-microservice
cloud cloud-computing-for-data coursera duke duke-coursera-ccb-lab2 flask
Last synced: 4 months ago
JSON representation
Small Flask Microservice that makes the change
- Host: GitHub
- URL: https://github.com/noahgift/flask-change-microservice
- Owner: noahgift
- License: cc0-1.0
- Created: 2020-11-29T22:02:11.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-16T18:45:41.000Z (over 2 years ago)
- Last Synced: 2025-03-18T20:49:28.616Z (4 months ago)
- Topics: cloud, cloud-computing-for-data, coursera, duke, duke-coursera-ccb-lab2, flask
- Language: Python
- Homepage: https://paiml.com
- Size: 15.6 KB
- Stars: 25
- Watchers: 2
- Forks: 162
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/noahgift/flask-change-microservice/actions/workflows/main.yml)
# flask-change-microservice
Small Flask Microservice that makes change*Coursera Lab: duke-coursera-ccb-lab2*

## Invoke Endpoint
* Create virtualenv and source it: `python3 -m venv ~/.fcm && source ~/.venv/bin/fcm`
* Install and Test: `make all`
* Run it: `python app.py`
* Invoke it. Options include curl, Postman, httpie. These methods are documented below### Curl
`curl http://127.0.0.1:8080/change/1/34`
```bash
[
{
"5": "quarters"
},
{
"1": "nickels"
},
{
"4": "pennies"
}
]
```
### httpie[Installation of httpie](https://httpie.io/docs#installation)
`http 127.0.0.1:8080/change/1/34`
```bash
HTTP/1.0 200 OK
Content-Length: 90
Content-Type: application/json
Date: Tue, 16 Mar 2021 16:49:11 GMT
Server: Werkzeug/1.0.1 Python/3.9.0[
{
"5": "quarters"
},
{
"1": "nickels"
},
{
"4": "pennies"
}
]
```### Postman
[Install Postman](https://www.postman.com)
### Requests
The [Python requests library](https://requests.readthedocs.io/en/latest/user/quickstart/) allows you to invoke a request as a "one-liner" or a script.
`python -c "import requests;r=requests.get('http://127.0.0.1:8080/change/1/34');print(r.json())"`
Result:
`[{'5': 'quarters'}, {'1': 'nickels'}, {'4': 'pennies'}]`
## Loadtest with Locust
* [Install Locust](https://github.com/locustio/locust)
* Create a `locustfile.py`
* Run loadtests


