DelphiLearn PythonPythonPython GUIRAD Studio

Tutorial: Using The Delphi REST Client To Access Python REST Server (Flask)

woman wearing red and black checkered blouse using macbook

REST (REpresentational State Transfer) has emerged as the standard architectural design for web services and web APIs in these recent years.

This post will demonstrate how easy it is to use the Delphi REST Client Library to access Python REST Server (Flask microframework).

Prerequisites: If this is your first time to set up Delphi’s REST Client Library in RAD Studio for accessing any REST-based web services, you can read this article to set them up. But, there are several differences in configurations for accessing Flask’s Python REST server. This article will show you the details about it. Also, you can read this tutorial to set up your first Python Flask REST Server.

1. Turn-On your Flask Server

Turn on your Flask server, by navigating to your project’s path, and run this command:

This is how it looks like in the command prompt:

1 0 8421956


2. Creating the Project

Open your RAD Studio and create a new project:

  • For Delphi, choose File > New > Multi-Device Application – Delphi > Blank Application.
1 1 7024310


3. Adding the REST Components

  1. Drop the TRESTClient, TRESTRequest, and TRESTResponse components on the form.

2. In the Object Inspector, set the BaseURL property of the TRESTClient to (your Flask’s server)

1 3 5595983

3. Select the TRESTRequest component on the form and set the following properties:

1 4 9895163
  • In the Structure View, expand the Params node.
  • Right-click the Params node, and click Add item on the context menu.
  • Under Params, click the newly added parameter 0-.
  • In the Object Inspector, set the parameter name to id, and the parameter value to 1.
1 5 8859422


4. Connecting to Python Flask Server

Right-click the TRESTRequest component and select Execute. If you are connected successfully, this window will shows up:

1 2 5196181

Congratulations! You have integrated what “seems complicated concept” Python REST Server with Delphi, using Delphi’s REST Client.

Check out Python4Delphi which easily allows you to build Python GUIs for Windows using Delphi.


Related posts
CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How To Create A Weather App With The Python Delphi Ecosystem and Weatherstack API

CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How To Create A Music Player With The Python Delphi Ecosystem


Unlock the Power of Python for Deep Learning with Transformer Architecture - The Engine Behind ChatGPT

CodeDelphiDelphiFMXLearn PythonProjectsPythonPython GUI

How to Build An Image Editor Using DelphiFMX Python Package

Leave a Reply

Your email address will not be published. Required fields are marked *