Software Alternatives & Reviews

Building a barebone Web API service in Python without a web framework

Python Poetry Gunicorn FastAPI
  1. Python packaging and dependency manager.
    Pricing:
    • Open Source
    As with every project, we need to create it. Open up your terminal/cmd/PowerShell and navigate to the directory where the project will be housed. Then create the project. For me, I used poetry to bootstrap a typical python project like so:.

    #Kids #Front End Package Manager #Package Manager 144 social mentions

  2. Gunicorn is a Python WSGI HTTP Server for UNIX.
    Pricing:
    • Open Source
    The simple script above is the app's entry point. It's a two-liner housed by the app function. This function takes the environ and start_reponse arguments, the requirements for gunicorn apps as defined here. The environ serves as the "request" object which contains all the details of all incoming requests to the app. As for the start_reponse, it defines the response's status code and headers. This function returns an Iterator of bytes. For data consistency, we passed only one instance of the User model defined previously to the url_hadndlers, housed in the urls.py file. The content of which is shown below:.

    #Web And Application Servers #Web Servers #Application Server 31 social mentions

  3. FastAPI is an Open Source, modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints.
    Pricing:
    • Open Source
    • Free
    Have you ever wondered how Python web frameworks work under the hood? Are you interested in just playing with python and not the complexities of its web frameworks such as Django, Flask, FastAPI, and so on? Do you know that with just Python, you can have some functionalities built? Do you want to explore the popular Python WSGI HTTP Server for UNIX, Gunicorn 'Green Unicorn'? If these sound interesting to you, welcome onboard! We will be exploiting the capabilities of gunicorn to serve our "sketchy", barebone, and "not-recommended-for-production" web API service with the following features:.

    #Developer Tools #API Tools #Python Programming 235 social mentions

Discuss: Building a barebone Web API service in Python without a web framework

Log in or Post with