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
Ready-to-use and customizable users management for FastAPI

FastAPI Users Ready-to-use and customizable users management for FastAPI Documentation: https://fastapi-users.github.io/fastapi-users/ Source Code: ht

FastAPI Users 2.3k Dec 30, 2022
MQTT FastAPI Wrapper With Python

mqtt-fastapi-wrapper Quick start Create mosquitto.conf with the following content: ➜ /tmp cat mosquitto.conf persistence false allow_anonymous true

Vitalii Kulanov 3 May 09, 2022
Twitter API monitor with fastAPI + MongoDB

Twitter API monitor with fastAPI + MongoDB You need to have a file .env with the following variables: DB_URL="mongodb+srv://mongodb_path" DB_URL2=

Leonardo Ferreira 3 Apr 08, 2022
REST API with FastAPI and JSON file.

FastAPI RESTAPI with a JSON py 3.10 First, to install all dependencies, in ./src/: python -m pip install -r requirements.txt Second, into the ./src/

Luis Quiñones Requelme 1 Dec 15, 2021
Instrument your FastAPI app

Prometheus FastAPI Instrumentator A configurable and modular Prometheus Instrumentator for your FastAPI. Install prometheus-fastapi-instrumentator fro

Tim Schwenke 441 Jan 05, 2023
A simple Blogging Backend app created with Fast API

This is a simple blogging app backend built with FastAPI. This project is created to simulate a real CRUD blogging system. It is built to be used by s

Owusu Kelvin Clark 13 Mar 24, 2022
FastAPI framework plugins

Plugins for FastAPI framework, high performance, easy to learn, fast to code, ready for production fastapi-plugins FastAPI framework plugins Cache Mem

RES 239 Dec 28, 2022
A simple example of deploying FastAPI as a Zeit Serverless Function

FastAPI Zeit Now Deploy a FastAPI app as a Zeit Serverless Function. This repo deploys the FastAPI SQL Databases Tutorial to demonstrate how a FastAPI

Paul Weidner 26 Dec 21, 2022
✨️🐍 SPARQL endpoint built with RDFLib to serve machine learning models, or any other logic implemented in Python

✨ SPARQL endpoint for RDFLib rdflib-endpoint is a SPARQL endpoint based on a RDFLib Graph to easily serve machine learning models, or any other logic

Vincent Emonet 27 Dec 19, 2022
Generate Class & Decorators for your FastAPI project ✨🚀

Classes and Decorators to use FastAPI with class based routing. In particular this allows you to construct an instance of a class and have methods of that instance be route handlers for FastAPI & Pyt

Yasser Tahiri 34 Oct 27, 2022
Cube-CRUD is a simple example of a REST API CRUD in a context of rubik's cube review service.

Cube-CRUD is a simple example of a REST API CRUD in a context of rubik's cube review service. It uses Sqlalchemy ORM to manage the connection and database operations.

Sebastian Andrade 1 Dec 11, 2021
FastAPI Server Session is a dependency-based extension for FastAPI that adds support for server-sided session management

FastAPI Server-sided Session FastAPI Server Session is a dependency-based extension for FastAPI that adds support for server-sided session management.

DevGuyAhnaf 5 Dec 23, 2022
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
Asynchronous event dispatching/handling library for FastAPI and Starlette

fastapi-events An event dispatching/handling library for FastAPI, and Starlette. Features: straightforward API to emit events anywhere in your code ev

Melvin 238 Jan 07, 2023
High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (w/ Redis and PostgreSQL).

fastapi-gino-arq-uvicorn High-performance Async REST API, in Python. FastAPI + GINO + Arq + Uvicorn (powered by Redis & PostgreSQL). Contents Get Star

Leo Sussan 351 Jan 04, 2023
FastAPI + PeeWee = <3

FastAPIwee FastAPI + PeeWee = 3 Using Python = 3.6 🐍 Installation pip install FastAPIwee 🎉 Documentation Documentation can be found here: https://

16 Aug 30, 2022
CURSO PROMETHEUS E GRAFANA: Observability in a real world

Curso de monitoração com o Prometheus Esse curso ensina como usar o Prometheus como uma ferramenta integrada de monitoração, entender seus conceitos,

Rafael Cirolini 318 Dec 23, 2022
FastAPI-Amis-Admin is a high-performance, efficient and easily extensible FastAPI admin framework. Inspired by django-admin, and has as many powerful functions as django-admin.

简体中文 | English 项目介绍 FastAPI-Amis-Admin fastapi-amis-admin是一个拥有高性能,高效率,易拓展的fastapi管理后台框架. 启发自Django-Admin,并且拥有不逊色于Django-Admin的强大功能. 源码 · 在线演示 · 文档 · 文

AmisAdmin 318 Dec 31, 2022
Sample-fastapi - A sample app using Fastapi that you can deploy on App Platform

Getting Started We provide a sample app using Fastapi that you can deploy on App

Erhan BÜTE 2 Jan 17, 2022
Repository for the Demo of using DVC with PyCaret & MLOps (DVC Office Hours - 20th Jan, 2022)

Using DVC with PyCaret & FastAPI (Demo) This repo contains all the resources for my demo explaining how to use DVC along with other interesting tools

Tezan Sahu 6 Jul 22, 2022