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 basic JSON-RPC implementation for your Flask-powered sites

Flask JSON-RPC A basic JSON-RPC implementation for your Flask-powered sites. Some reasons you might want to use: Simple, powerful, flexible and python

Cenobit Technologies 273 Dec 1, 2022
An alternative implement of Imjad API | Imjad API 的开源替代

HibiAPI An alternative implement of Imjad API. Imjad API 的开源替代. 前言 由于Imjad API这是什么?使用人数过多, 致使调用超出限制, 所以本人希望提供一个开源替代来供社区进行自由的部署和使用, 从而减轻一部分该API的使用压力 优势

Mix Technology 450 Dec 29, 2022
Run your jupyter notebooks as a REST API endpoint. This isn't a jupyter server but rather just a way to run your notebooks as a REST API Endpoint.

Jupter Notebook REST API Run your jupyter notebooks as a REST API endpoint. This isn't a jupyter server but rather just a way to run your notebooks as

Invictify 54 Nov 4, 2022
Beyonic API Python official client library simplified examples using Flask, Django and Fast API.

Beyonic API Python Examples. The beyonic APIs Doc Reference: https://apidocs.beyonic.com/ To start using the Beyonic API Python API, you need to start

Harun Mbaabu Mwenda 46 Sep 1, 2022
Practice-python is a simple Fast api project for dealing with modern rest api technologies.

Practice Python Practice-python is a simple Fast api project for dealing with modern rest api technologies. Deployment with docker Go to the project r

null 0 Sep 19, 2022
MS Graph API authentication example with Fast API

MS Graph API authentication example with Fast API What it is & does This is a simple python service/webapp, using FastAPI with server side rendering,

Andrew Hart 4 Aug 11, 2022
api versioning for fastapi web applications

fastapi-versioning api versioning for fastapi web applications Installation pip install fastapi-versioning Examples from fastapi import FastAPI from f

Dean Way 472 Jan 2, 2023
api versioning for fastapi web applications

fastapi-versioning api versioning for fastapi web applications Installation pip install fastapi-versioning Examples from fastapi import FastAPI from f

Dean Way 127 Feb 17, 2021
Cookiecutter API for creating Custom Skills for Azure Search using Python and Docker

cookiecutter-spacy-fastapi Python cookiecutter API for quick deployments of spaCy models with FastAPI Azure Search The API interface is compatible wit

Microsoft 379 Jan 3, 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 4, 2023
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 executable files or Docker images.

Machine Learning Tooling 2.8k Jan 4, 2023
Restful Api developed with Flask using Prometheus and Grafana for monitoring and containerization with Docker :rocket:

Hephaestus ?? In Greek mythology, Hephaestus was either the son of Zeus and Hera or he was Hera's parthenogenous child. ... As a smithing god, Hephaes

Yasser Tahiri 16 Oct 7, 2022
Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⭐

FRDP Boilerplate code for quick docker implementation of REST API with JWT Authentication using FastAPI, PostgreSQL and PgAdmin ⛏ . Getting Started Fe

BnademOverflow 53 Dec 29, 2022
A comprehensive CRUD API generator for SQLALchemy.

FastAPI Quick CRUD Introduction Advantage Constraint Getting started Installation Usage Design Path Parameter Query Parameter Request Body Upsert Intr

null 192 Jan 6, 2023
Fast, simple API for Apple firmwares.

Loyal Fast, Simple API for fetching Apple Firmwares. The API server is closed due to some reasons. Wait for v2 releases. Features Fetching Signed IPSW

null 11 Oct 28, 2022
API for Submarino store

submarino-api API for the submarino e-commerce documentation read the documentation in: https://submarino-api.herokuapp.com/docs or in https://submari

Miguel 1 Oct 14, 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 6, 2021
API Simples com python utilizando a biblioteca FastApi

api-fastapi-python API Simples com python utilizando a biblioteca FastApi Para rodar esse script são necessárias duas bibliotecas: Fastapi: Comando de

Leonardo Grava 0 Apr 29, 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