Skip to main content

crud defiend by json

Project description

main.py / app.py - example

from flask import Flask from flask_cors import CORS from crud_mysql import crud

app = Flask(name)

app.register_blueprint(crud)

if name == "main": app.run(host="0.0.0.0", debug=True)

cred.json - example

{ "user": { "allowd_methods": ["GET", "POST", "DELETE", "PUT"], "fetch_all": "true", "schema": { "name": "VARCHAR(100)", "email": "VARCHAR(100)", "encrypted_password": "VARCHAR(100)", "account_id": "INT", "is_active": "INT" } }, "account": { "allowd_methods": ["GET", "POST", "DELETE"], "fetch_all": "false", "schema": { "name": "VARCHAR(100)", "subscription_type": "VARCHAR(100)", "root_user": "INT" } } }

using tokens:

to protect endpoints by verifying tokens - add protected_methods to that object for example:

{ "car": { "allowd_methods": ["GET", "POST", "DELETE", "PUT"], "protected_methods": ["GET"], "fetch_all": "true", "schema": { "owner": "VARCHAR(100)", "color": "VARCHAR(100)", "licence_plate": "INT" } } }

here when using "GET" to get a car we will need to add a token.

in order for this to work a few things need to be set: an environment varriable JWT_ALGORITHM should be set. the options are:

  • RS256
  • HS256 if none are set it will default to HS256.

if the algorithim being used is HS256 then a variable needs to be set for SECRET_KEY. this has to be the same SECRET_KEY that was used for creating the jwt.

if the algorithim being used is RS256. a variable needs to be set for SECRET_KEYS_PATH. and at that path there needs to be a public.pem it has to be the same cert that was used to create the jwt.

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

crud_mysql-0.1.7.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

crud_mysql-0.1.7-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file crud_mysql-0.1.7.tar.gz.

File metadata

  • Download URL: crud_mysql-0.1.7.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for crud_mysql-0.1.7.tar.gz
Algorithm Hash digest
SHA256 0ca59906576c9ddfc8ee27caeeeca3f972d90e7bee60d2adf815e9397dca2c13
MD5 dcadaa457cce1f1111417a7e6c6d73ac
BLAKE2b-256 2e04f39592ff95104ea45528699f3f5bd31421010c76015d0c78f0bd23ec2dda

See more details on using hashes here.

File details

Details for the file crud_mysql-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: crud_mysql-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for crud_mysql-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 3f59fd0bffab0e6deedde5adb7c2d9318553fae53c20f5fd54f0e2b1e674293c
MD5 41ba38d3b224509759cf577849317ec5
BLAKE2b-256 1377f83a2456c26d8f8b389b42267f4e132d5e7c777be00ab6443be4ae00b72b

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