Skip to main content

Python API for WebFramework

Project description

C++ HTTP/HTTPS server with Python API

Quick start

Server needs few files to run:

main.py

from web_framework_api.WebFramework import WebFramework  # Server
from web_framework_api.utility.DLLHandler import initialize_web_framework  # WebFramework initialization 
from web_framework_api.exceptions.WebFrameworkException import WebFrameworkException  # Exception

def on_start():
  print("Server is running")

if __name__ == '__main__':
  try:
    initialize_web_framework()  # Load WebFramework shared library

    server = WebFramework.from_path("config.json")  # Create server

    server.start(True, on_start)  # Start server and wait
  except WebFrameworkException as exception:
    print(exception)

    exit(-1)

Settings

web.json

{
  "HelloExecutor": {
    "route": "",
    "loadType": "initialization",
    "api": "python"
  }
}

Config

config.json

{
  "WebServer": {
    "ip": "0.0.0.0",
    "port": 8080,
    "timeout": 0
  },
  "WebFramework": {
    "settingsPaths": [
      "web.json"
    ],
    "loadSources": [
      "hello_executor"
    ],
    "runtimes": [
      "python"
    ],
    "assetsPath": "assets",
    "templatesPath": "templates",
    "cachingSize": 536870912,
    "webServerType": "multiThreaded",
    "HTTPS": {
      "useHTTPS": false,
      "pathToCertificate": "certificates/cert.pem",
      "pathToKey": "certificates/key.pem"
    },
    "defaultAssetsPath": "WebFrameworkAssets"
  },
  "Logging": {
    "usingLogging": false,
    "dateFormat": "DMY",
    "logFileSize": 134217728
  },
  "ThreadPoolServer": {
    "threadCount": 0
  }
}

Run sample

After running server open url 127.0.0.1:8080.
You will see response from server

{
  "message": "Hello, World!"
}

Executors

Executors are C++, C, Python or C# classes that responsible for giving responses for their route(url).
Source code of HelloExecutor from example
hello_executor.py

from web_framework_api import *

class HelloExecutor(StatelessExecutor):
    def do_get(self, request, response):
        response.set_body({
            "message": "Hello, World!"
        })

More information you can find in wiki.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

web_framework_api-3.4.1-cp314-cp314-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.14Windows x86-64

web_framework_api-3.4.1-cp314-cp314-manylinux_2_34_x86_64.whl (45.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

web_framework_api-3.4.1-cp314-cp314-manylinux_2_34_aarch64.whl (44.2 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

web_framework_api-3.4.1-cp313-cp313-win_amd64.whl (6.2 MB view details)

Uploaded CPython 3.13Windows x86-64

web_framework_api-3.4.1-cp313-cp313-manylinux_2_34_x86_64.whl (45.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

web_framework_api-3.4.1-cp313-cp313-manylinux_2_34_aarch64.whl (44.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

web_framework_api-3.4.1-cp312-cp312-win_amd64.whl (6.2 MB view details)

Uploaded CPython 3.12Windows x86-64

web_framework_api-3.4.1-cp312-cp312-manylinux_2_34_x86_64.whl (45.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

web_framework_api-3.4.1-cp312-cp312-manylinux_2_34_aarch64.whl (44.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

File details

Details for the file web_framework_api-3.4.1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 9b84204d1759e18234fb51162f6ae8b05aca26c5d76fa8a45107a71c4be68c33
MD5 f23f93af6d2ff3688fa393fa6ac591bf
BLAKE2b-256 8cfa42ce72a1e4e63f0db27e43bef01ab429b597760a699d8658c69672f22a1b

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 aaf70cea60829807f5fe194bd8ccdc7c143eb98f759e137ba0112f83532db6cc
MD5 57d7a22c22f1ccdcd95397c77ea7a0ab
BLAKE2b-256 095667a82e8b095834937890319c88c7f89eda14f8a987b5883ae04959e65fe6

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9ef415eb099bca99f7b90907e7e477732ce69eacbc7157f4eb257564ea331283
MD5 24131f4c31f2f70e77b16bebb8a71c92
BLAKE2b-256 a4633bf839be488224e1ca55aa861d53cf9eae7ebdeea65bbb09cd5a938a0b12

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5b92281212907df6e1354ecc9451a900fc8e2867a81d82c0deb2263dd8373b28
MD5 3c2d7c279d048f98a2908bc039306100
BLAKE2b-256 0610a015fb2a397197985e23f8016cd707f858486e6508a316ae5718df9fbb57

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7e7306e075ad8311400d7d76c0c6edf8caa464b20c4b91945e5786231e56fc9d
MD5 d981c2b81e2c37892c9d025b3ba5135a
BLAKE2b-256 1455d7433cbd16eae594a719d567872e6b39da1783b2f9ea29347a8d275f6d5f

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 23f3d6bf20371b1d39684e2c90062ae67b96832024ce2306de0c57a75c4d6a5d
MD5 60cfd8213f3c76c91e70132f96f76989
BLAKE2b-256 fd831b6ef7691293cec0f1cfa3d16f076ccc98e67a970289cb055d3ed688b133

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 58e4062f994ecfa6947c50a2c728655f50cdd0ab1de5ac1b2068809afb0ea32d
MD5 bbb59239b5a2ffd976228dbf70de3de3
BLAKE2b-256 079eb7246a70015ede50d796547b2290e94a0e1853b1f1d5a0b8e0f84741f52b

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 75521ea68a51ceac20026afd051c9db835a4d229096d8d001e73f31a28651a09
MD5 a6aeac0f64224b1017f159ee70bf9aca
BLAKE2b-256 f30594431af8c2187c3844faab908ad0da66423341b206116c1d19153206b4b6

See more details on using hashes here.

File details

Details for the file web_framework_api-3.4.1-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.1-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 60ac9cb12ab6c05f4452ce76b5828ab77fd0d9a7de0dfe30513983555e4096fd
MD5 056bae72df7adb68ec700af6b0176946
BLAKE2b-256 507b44bdf369f8ac59a5155c0c76bd1b540712c111e0ab2f4bc5c335af0419db

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