How it works...

This recipe uses the third-party Flask library to create a simple RESTful application with the services that we design.

As we designed, the web service accepts the inputs in the formal:

http://127.0.0.1:5000/<int> 

The integer value is taken as the input to both our Fibonacci and Square functions. The computation is done in the Python backend and the output is printed back in the browser—as the output of the web service.

The program can be run with debug mode turned off as well, though in our example we have left it in the debug mode to get more verbose logs.

To learn more about Flask, visit their website at: http://flask.pocoo.org/. There are other alternatives to Flask such as Django (https://docs.djangoproject.com/en/1.11/) and other frameworks that are built on top of Flask such as Eve (http://python-eve.org/) that you may also find useful to build RESTful web services and web applications using Python.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.181.47