This is a toy Flask HTTP API (not really RESTful) that get contentLengths for a list of URLs, mainly used to demonstrate testing.
Note that this was tested using Python 3.7 and will certainly not work in Python 2.
- Clone the git directory.
git clone git@github.com:davidfaulkner12/content_length_service.git
- (Optional) Create a virtualenv in that directory.
virtualenv content_length_service
source content_length_service/bin/activate
- Install the requirements
cd content_length_service
pip install -r requirements.txt
- Run the tests.
python -m unittest tests/test_*
- (Optional) Run the conformance tests with the "real" urllib from the standard library.
python conformance_test/run_http_gateway.py
- (Optional) Run the app (with a stub library).
python app.py
curl -i -X POST -H "Content-Type: application/json" -d '{"urls":["https://www.bbc.com/","https://www.google.com/"]}' http://localhost:5000/content_lengths