module server.filestore_fastapi

Inheritance diagram of pyquickhelper.server.filestore_fastapi

Short summary

module pyquickhelper.server.filestore_fastapi

Simple class to store and retrieve files through an API.

source on GitHub

Classes

class

truncated documentation

Item

Metric

Query

QueryL

Functions

function

truncated documentation

_get_password

_post_request

create_app

Creates an instance of application class returned by create_fast_api_app(). It checks that environment variables …

create_fast_api_app

Creates a REST application based on FastAPI.

fast_api_content

Retrieves the dataframes based on partial information. Enumerates a list of dataframes.

fast_api_query

Retrieves the list of dataframe based on partial information.

fast_api_submit

Stores a dataframe into a local stores.

Documentation

Simple class to store and retrieve files through an API.

source on GitHub

pyquickhelper.server.filestore_fastapi._get_password(password, env='PYQUICKHELPER_FASTAPI_PWD')[source]
pyquickhelper.server.filestore_fastapi._post_request(client, url, data, suffix, timeout=None)[source]
pyquickhelper.server.filestore_fastapi.create_app()[source]

Creates an instance of application class returned by create_fast_api_app. It checks that environment variables PYQUICKHELPER_FASTAPI_PWD and PYQUICKHELPER_FASTAPI_PATH are set up with a password and a filename. Otherwise, the function raised an exception.

Inspired from the guidelines uvicorn/deployment, (2). Some command lines:

uvicorn --factory pyquickhelper.server.filestore_fastapi:create_app --port 8798
        --ssl-keyfile=./key.pem --ssl-certfile=./cert.pem
gunicorn --keyfile=./key.pem --certfile=./cert.pem -k uvicorn.workers.UvicornWorker
         --factory pyquickhelper.server.filestore_fastapi:create_app --port 8798
nohup python -m uvicorn --factory pyquickhelper.server.filestore_fastapi:create_app
      --port xxxx --ssl-keyfile=./key.pem --ssl-certfile=./cert.pem
      --host xx.xxx.xx.xxx --ssl-keyfile-password xxxx > fastapi.log &
uvicorn.run("pyquickhelper.server.filestore_fastapi:create_app",
            host="127.0.0.1", port=8798, log_level="info", factory=True)
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365

source on GitHub

pyquickhelper.server.filestore_fastapi.create_fast_api_app(db_path, password)[source]

Creates a REST application based on FastAPI.

Returns

app

source on GitHub

pyquickhelper.server.filestore_fastapi.fast_api_content(client=None, url=None, name=None, team=None, project=None, version=None, limit=5, password=None, as_df=True)[source]

Retrieves the dataframes based on partial information. Enumerates a list of dataframes.

Parameters
  • client – for unittest purpose

  • url – API url (can be None if client is not)

  • name – name

  • team – team

  • project – project

  • version – version

  • limit – maximum number of dataframes to retrieve

  • as_df – returns the content as a dataframe

  • password – password for the submission

Returns

list of dictionary, content is a dataframe

source on GitHub

pyquickhelper.server.filestore_fastapi.fast_api_query(client=None, url=None, name=None, team=None, project=None, version=None, password=None, as_df=False)[source]

Retrieves the list of dataframe based on partial information.

Parameters
  • client – for unittest purpose

  • url – API url (can be None if client is not)

  • name – name

  • team – team

  • project – project

  • version – version

  • password – password for the submission

Returns

response

source on GitHub

pyquickhelper.server.filestore_fastapi.fast_api_submit(df, client=None, url=None, name=None, team=None, project=None, version=None, password=None)[source]

Stores a dataframe into a local stores.

Parameters
  • df – dataframe

  • client – for unittest purpose

  • url – API url (can be None if client is not)

  • name – name

  • team – team

  • project – project

  • version – version

  • password – password for the submission

Returns

response

source on GitHub