How to Implement Cross-Origin Resource Sharing on CherryPy Platform of Python

Wasun Khan-Am

Abstract


Abstract— This article presents how to implement Cross-Origin Resource Sharing, aka CORS, on CherryPy platform of Python. This experiment is under the concept of RESTful. The tools of this experiment are python 3, CherryPy Framework version 18, SQLite 3, USBWebserver version 8.0, JQuery version 1.12, AJAX approach, and use Mozilla Firefox as a web browser. The hardware tool is a laptop computer. Four methods of HTTP methods, namely GET, POST, PUT, and DELETE; based on the concept of RESTful. Those methods were built on CherryPy platform before being tested in the next order. There are three outputs of this experiment that has been shown in this article. Firstly, the RESTful concept has been able to apply by using a Python 3 on CherryPy platform. Secondly, two methods, such as GET and POST, have been able to directly implement under CORS concept with a simple request. Thirdly, the rest method, PUT and DELETE, have been able to apply under CORS concept by using a preflight request.

Full Text:

PDF

References


Kingleo713, MDN Web docs “Web APIs”, Feb 28, 2019 Avialable: https://developer.mozilla.org/en-US/docs/Web/API, [Online] [Accessed: Mar. 3, 2019]

Wikipedia, ‘Web API’, Feb. 28, 2019, Avialable: https://en.wikipedia.org/wiki/Web_API [Online][Accessed: Mar. 3, 2019]

Python Software Foundation, Python 3.7.3 documentation, Aviable: https://docs.python.org/3/ [Online] [Accessed : Mar 3, 2019.

CherryPy Team. CherryPy “CherryPy – A Minimalist Python Web Framework”, 2019. Available: https://docs.cherrypy.org/en/latest/ [Online] [Accessed: Mar.3, 2019]

D. Booth H. Haas, F. McCane, E. NewCommer, M. Champion, C. Ferris, D. Orchard “Web Services Architecture” World Wide Web Consortium, 11 Feb. 2004, Available: https://www.w3.org/TR/2004/NOTE-ws-arch-20040211/#relwwwrest [Online] [Accessed: Mar. 3, 2019]

R. Fielding, and J. Reschke, RFC7231 Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. Internet Engineering Task Force, June 2014.

SQLite, ‘SQLite Document’. Available: https://www.sqlite.org/docs.html. [Online][Accessed: Mar 23, 2019]

sideshowbarker, ‘MDN Web Docs, Cross-Origin Resource Sharing (CORS) – HTTP | MDN’, Apr 12, 2019, 5:31:26 PM. Available: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS. [Online][Accessed: Mar 3, 2019]

A. V. Kesteren, ‘World Wide Web Consortium Cross-Origin Resource Sharing’, Jan 16, 2014. Available: https://www.w3.org/TR/cors/. [Online] [Accessed: Mar 3, 2019]

Mdnwebdocs-bot. ‘Ajax – Developer guides | MDN’, Mar 23, 2019. Available: https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX [Online] [Accessed: Apr 10, 2019]

Mdnwebdocs-bot, ‘Getting Started –Developer guide’, Mar 18, 2019. Available: https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX/Getting_Started [Online] [Accessed: Apr 10, 2019]

JS foundation. ‘JQuery API Document’, 2019. Available: https://api.jquery.com/ [Online] [Accessed: May 20, 2019]


Refbacks

  • There are currently no refbacks.