Browse JSON API in a HTML interface.

Overview

Falcon API Browse

This project provides a middleware for Falcon Web Framework that will render the response in an HTML form for documentation purpose. It uses the docstring from the Resource object and all the supported HTTP methods for the resource.

It is inspired by Django Rest Framework's Browsable API and is written using jinja2 templating language.

Installing

This project is currently in early stages of development. Once it is stable enough to be used by other projects, it will be provided via PyPI.

pip install git+https://github.com/maxking/falcon-api-browse

Using

Since this is a middleware for Falcon, you can use it by passing an initialized instance during Falcon App creation.

from falcon import App
from falcon_api_browse import HTMLResponseMiddleware

app = App(middleware=HTMLResponseMiddleware())

Examples

There are some runnable examples in examples/ directory.

LICENSE

This project and contents of this repo are licensed under Apache 2.0 License.

Comments
  • JSON from `resp.media` is not recognized

    JSON from `resp.media` is not recognized

    It seems this only works as expected if JSON is rendered via resp.text; however, the most idiomatic and succinct way of writing a JSON API is by leveraging req.get_media() and resp.media.

    Test case used:

    import falcon
    from falcon_api_browse import HTMLResponseMiddleware
    
    
    class Hello:
        def on_get(self, req, resp):
            resp.media = {'message': 'Hello, World!', 'cool': True}
    
    
    app = falcon.App(middleware=[HTMLResponseMiddleware()])
    app.add_route('/hello', Hello())
    
    enhancement 
    opened by vytas7 4
  • No module named `importlib_resources`

    No module named `importlib_resources`

    It seems that some dependencies are required, but not listed:

      File "/tmp/test.py", line 2, in <module>
        from falcon_api_browse import HTMLResponseMiddleware
      File "/tmp/venv/lib/python3.8/site-packages/falcon_api_browse/__init__.py", line 1, in <module>
        from falcon_api_browse.middleware import HTMLResponseMiddleware
      File "/tmp/venv/lib/python3.8/site-packages/falcon_api_browse/middleware.py", line 1, in <module>
        from falcon_api_browse.views import html_response
      File "/tmp/venv/lib/python3.8/site-packages/falcon_api_browse/views.py", line 4, in <module>
        from importlib_resources import files
    ModuleNotFoundError: No module named 'importlib_resources'
    
    bug 
    opened by vytas7 1
  • Add an explicit dependency on importlib-resources.

    Add an explicit dependency on importlib-resources.

    On newer version of Python, this is a stdlib package, but the API still differs in different version. Adding a dependeny on this makes it usable on all Python version while it handles noop operation on Python versions that have the same API as this package.

    Fixes #4

    opened by maxking 0
  • ASGI support

    ASGI support

    Since HTMLResponseMiddleware doesn't seem to perform any taxing I/O, one could implement ASGI support by simply wrapping the current logic via async def process_response_async(...).

    enhancement 
    opened by vytas7 0
  • Add some CSS to the default template

    Add some CSS to the default template

    The current default template is very vanilla, it could use some styling support with CSS. We could also urlize some of the urls, although it doesn't seem to work with the default urlize function for whatever reason (probably, because URLs are strings with "<url>" enclosing quotes that throws off their regex matcher.

    enhancement help wanted 
    opened by maxking 0
  • Verify the response's content_type before assuming it is JSON

    Verify the response's content_type before assuming it is JSON

    We currently assume that the response is JSON, but it can be anything like HTML, msgpack etc. We should not make this assumption and add some guard to verify the response's content_type.

    enhancement help wanted good first issue 
    opened by maxking 0
Releases(0.1.0)
  • 0.1.0(Mar 14, 2022)

Owner
Abhilash Raj
GNU Mailman lead developer. @python core dev. I have code over at https://gitlab.com/maxking
Abhilash Raj
A dynamic FastAPI router that automatically creates CRUD routes for your models

⚡ Create CRUD routes with lighting speed ⚡ A dynamic FastAPI router that automatically creates CRUD routes for your models

Adam Watkins 950 Jan 08, 2023
Redis-based rate-limiting for FastAPI

Redis-based rate-limiting for FastAPI

Glib 6 Nov 14, 2022
A minimal Streamlit app showing how to launch and stop a FastAPI process on demand

Simple Streamlit + FastAPI Integration A minimal Streamlit app showing how to launch and stop a FastAPI process on demand. The FastAPI /run route simu

Arvindra 18 Jan 02, 2023
This project shows how to serve an ONNX-optimized image classification model as a web service with FastAPI, Docker, and Kubernetes.

Deploying ML models with FastAPI, Docker, and Kubernetes By: Sayak Paul and Chansung Park This project shows how to serve an ONNX-optimized image clas

Sayak Paul 104 Dec 23, 2022
Keycloak integration for Python FastAPI

FastAPI Keycloak Integration Documentation Introduction Welcome to fastapi-keycloak. This projects goal is to ease the integration of Keycloak (OpenID

Code Specialist 113 Dec 31, 2022
REST API with FastAPI and PostgreSQL

REST API with FastAPI and PostgreSQL To have the same data in db: create table CLIENT_DATA (id SERIAL PRIMARY KEY, fullname VARCHAR(50) NOT NULL,email

Luis Quiñones Requelme 1 Nov 11, 2021
FastAPI CRUD template using Deta Base

Deta Base FastAPI CRUD FastAPI CRUD template using Deta Base Setup Install the requirements for the CRUD: pip3 install -r requirements.txt Add your D

Sebastian Ponce 2 Dec 15, 2021
Turns your Python functions into microservices with web API, interactive GUI, and more.

Instantly turn your Python functions into production-ready microservices. Deploy and access your services via HTTP API or interactive UI. Seamlessly export your services into portable, shareable, and

Machine Learning Tooling 2.8k Jan 04, 2023
Qwerkey is a social media platform for connecting and learning more about mechanical keyboards built on React and Redux in the frontend and Flask in the backend on top of a PostgreSQL database.

Flask React Project This is the backend for the Flask React project. Getting started Clone this repository (only this branch) git clone https://github

Peter Mai 22 Dec 20, 2022
Mixer -- Is a fixtures replacement. Supported Django, Flask, SqlAlchemy and custom python objects.

The Mixer is a helper to generate instances of Django or SQLAlchemy models. It's useful for testing and fixture replacement. Fast and convenient test-

Kirill Klenov 871 Dec 25, 2022
Пример использования GraphQL Ariadne с FastAPI и сравнение его с GraphQL Graphene FastAPI

FastAPI Ariadne Example Пример использования GraphQL Ariadne с FastAPI и сравнение его с GraphQL Graphene FastAPI - GitHub ###Запуск на локальном окру

ZeBrains Team 9 Nov 10, 2022
fastapi-admin2 is an upgraded fastapi-admin, that supports ORM dialects, true Dependency Injection and extendability

FastAPI2 Admin Introduction fastapi-admin2 is an upgraded fastapi-admin, that supports ORM dialects, true Dependency Injection and extendability. Now

Glib 14 Dec 05, 2022
flask extension for integration with the awesome pydantic package

flask extension for integration with the awesome pydantic package

249 Jan 06, 2023
A FastAPI Middleware of joerick/pyinstrument to check your service performance.

fastapi_profiler A FastAPI Middleware of joerick/pyinstrument to check your service performance. 📣 Info A FastAPI Middleware of pyinstrument to check

LeoSun 107 Jan 05, 2023
Complete Fundamental to Expert Codes of FastAPI for creating API's

FastAPI FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3 based on standard Python type hints. The key featu

Pranav Anand 1 Nov 28, 2021
LuSyringe is a documentation injection tool for your classes when using Fast API

LuSyringe LuSyringe is a documentation injection tool for your classes when using Fast API Benefits The main benefit is being able to separate your bu

Enzo Ferrari 2 Sep 06, 2021
FastAPI IPyKernel Sandbox

FastAPI IPyKernel Sandbox This repository is a light-weight FastAPI project that is meant to provide a wrapper around IPyKernel interactions. It is in

Nick Wold 2 Oct 25, 2021
Simple example of FastAPI + Celery + Triton for benchmarking

You can see the previous work from: https://github.com/Curt-Park/producer-consumer-fastapi-celery https://github.com/Curt-Park/triton-inference-server

Jinwoo Park (Curt) 37 Dec 29, 2022
Flask + marshmallow for beautiful APIs

Flask-Marshmallow Flask + marshmallow for beautiful APIs Flask-Marshmallow is a thin integration layer for Flask (a Python web framework) and marshmal

marshmallow-code 768 Dec 22, 2022
Regex Converter for Flask URL Routes

Flask-Reggie Enable Regex Routes within Flask Installation pip install flask-reggie Configuration To enable regex routes within your application from

Rhys Elsmore 48 Mar 07, 2022