RDKit is a widely used toolkit to work with molecules in different languages. Web APIs are interfaces that work with request-response message systems, commonly implemented in HTTP and accessible over the internet. Here we will take the RDKit’s function responsible for creating 2D molecular depictions and expose it over the internet, via HTTP, with a request-response system with the help of Flask and Python. We will be able to send molecules in SMILES format and our server will send us back the SVG representation of that molecule.
Writing idiomatic Python (also known as Pythonic code) is a skill that is greatly appreciated, since it improves both readability and maintainability of the code. Using a non-Pythonic ported from C++ I propose you how to adapt it using the Adapter design pattern. The non-Pythonic API RDKit is a widely used toolkit to work with molecules. With it you can compute properties, build molecules, fragment them, etc. The core data structures and algorithms are written in C++ and the Python wrappers are built automatically using Boost.