Skip to main content

for data authentication by middleware

Project description

Middleware Service Package

Middleware Service Package to manage the validation of client or server side requests.

  • Note: Please populate the .env file with own SECRET_KEY value into your local development root directory then import the Middleware Service Package for use in local development.

set the secret key value in .env file in following way, and changes the value in place of set_own_key_value

  • SECRET_KEY = set_own_key_value

For Local Development Setup

System Requirements for Middleware Service package

  • Python 3.9+
  • Pip 21.2.4+

Install and Create the virtual environment on current Operating System

$ pip install virtualenv
$ virtualenv myenv

Note: Above command create the myenv virtual environment folder and we can also set another name instead of myenv. then activate your virtual environment.

Check and Upgrade the pip and setuptool packages

$ python -m pip install --upgrade pip setuptools wheel

Install the Middleware Service Package in your virtual environment

$ pip3 install git+https://github.com/adcuratio/folks-middleware-service

For Succesfully Uninstall the Middleware Package

$ pip3 uninstall middleware_service

For Use Middleware Package In Local Developement

Use Middleware Package for all the api endpoints.

1. Import Middleware Package in following way

  • import middleware_service
  • from middleware_service import CustomMiddleware

2. Add the Middleware package with your FastApi app inside main.py File, like this

  • app = FastAPI()
  • app.add_middleware(CustomMiddleware)

3. Add all api router in main.py file by using ,

  • app.include_router(add_api_router)

Note: If you want to use Middleware Package for the particular router of the FastApi, then use mount option inside main.py file and add middleware inside sub_main.py file in following way:

Use Middleware Package for Paticular api endpoints.

1. First use the FastApi app in main file and Mount the sub app where you want to add middleware

  • app = FastAPI()
  • app.mount('/sub_app', sub_app)

2. Add all api router in main.py excluding one particular api, for which you want to use middleware package

  • app.include_router(add_api_router)

3. Create the sub main.py and Import Package with particular api router

  • from middleware_service import CustomMiddleware
  • sub_app = FastAPI()
  • sub_app.add_middleware(CustomMiddleware)

4. All only one api router to access the middleware package

  • sub_app.include_router(add_api_router)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

middleware_service-0.1.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

middleware_service-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file middleware_service-0.1.0.tar.gz.

File metadata

  • Download URL: middleware_service-0.1.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for middleware_service-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f378179b54663f6d64ce80055eafddddd28e3e54ff6ab9f808027448139458e8
MD5 9e4fa78ec9af33f7f6493249aa891d16
BLAKE2b-256 9ef81b0544cbb88e45c4b1190ba17ad3e826efbb2bbed7cfdbabbff32be3435f

See more details on using hashes here.

File details

Details for the file middleware_service-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: middleware_service-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for middleware_service-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b78b8dd496405726b716c3d978cc68998f515b65ed7b369ff6ccf28833652ae
MD5 b61d69aa90e7c33c6981d94b9838ab52
BLAKE2b-256 3d235b29653f4e882be6ea27295f9ff26461b9ae3540e7cc9e92d41cfdcc67e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page