Skip to content

davidfaulkner12/content_length_service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Flask Example with Testing

tl;dr

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.

Install and Run

  1. Clone the git directory.
git clone git@github.com:davidfaulkner12/content_length_service.git
  1. (Optional) Create a virtualenv in that directory.
virtualenv content_length_service
source content_length_service/bin/activate
  1. Install the requirements
cd content_length_service
pip install -r requirements.txt
  1. Run the tests.
python -m unittest tests/test_*
  1. (Optional) Run the conformance tests with the "real" urllib from the standard library.
python conformance_test/run_http_gateway.py
  1. (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

About

Toy Flask Service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages