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.2-cp314-cp314-win_amd64.whl (6.4 MB view details)

Uploaded CPython 3.14Windows x86-64

web_framework_api-3.4.2-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.2-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.2-cp313-cp313-win_amd64.whl (6.2 MB view details)

Uploaded CPython 3.13Windows x86-64

web_framework_api-3.4.2-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.2-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.2-cp312-cp312-win_amd64.whl (6.2 MB view details)

Uploaded CPython 3.12Windows x86-64

web_framework_api-3.4.2-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.2-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.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 d305e0fefd9444991dd98506ce64710aea098cdeb80c994f69817f9738ff6a80
MD5 ffaed4d560369dd8e7e8f88587458891
BLAKE2b-256 cb28afe26e8ae0884826589037687bdb5b07fa739982b68b4186ab79e8004ea0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d3b7aa523eac2fe1e41380ea2ce6aa100bc3fdfcc13962ed2e60349e2cc5bb1a
MD5 722b03e289fd6abea72b321ae913d0ff
BLAKE2b-256 7896b6051032054bfa434474a300532b08feb0e2707ed26257640f54dc1d161e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 0483ea9dc236b3bd398b384a54ccdf07fafc40c2c4236e3a5a10668800a90cad
MD5 ca15945ebc4222715d16b728ac2aab55
BLAKE2b-256 3b24f9ac014d993e684660d66d0bea95c5c43ece9d0fa61a06e00126a4316844

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1e5337fcbcef3b6e980391adfbc458c2a98c7053f898364b54c5a2ed09db8354
MD5 b4e16f4342fbe4ecdb6ac68e87d50437
BLAKE2b-256 caba4b6c4a6d8ea28541666030b5dd6915829e3f534e7b4f639b5c60ca7a53e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 250fb45475b4391706573186bab82a2f5fdf2531f1c37d939c5585a3fc0f0a92
MD5 98bcc4f1735cd21b24da911557bb2286
BLAKE2b-256 b5938afe6c9284d25ece20403a57454f21bd2053fbbb338d50d87569885908c7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 9f4afefccefd55bc853dcc41cf7078699aa97c3df120f965aa7b55607a271bbb
MD5 e50a361bee25283c796f4d17202c467c
BLAKE2b-256 6dfd211608d7af9ff0d741ec3ba0f74a7cbb95efe09353754edce7a3d79a0773

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0bee8e0062a90ffb25f79aa8e6e50524db0c80745b894995ad0daf355516ba41
MD5 507be75424b41198a0f2c8d39ed70869
BLAKE2b-256 b3be4f7234fe811681bd2e3a480a3ce30b18eb2143b8a3dded7179b0d56f7d68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7cd3a1faff32b846b1d00be1244e0157b9aad05375cf0d5df11e5ca8cb062ec4
MD5 aaf744c003c7fc0319b6f6d829ddecd7
BLAKE2b-256 bf6908ebfea9b6e9d1b8ef23581afc667889102bcebecb0ef9c3a5acafcbc488

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.2-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 8b6a66da5073aa74ff878da169519bc089fd9656b7bb26daabbd77e65c17a2f9
MD5 7555545a90c1f307793121b04ca257e1
BLAKE2b-256 b4b7f3406939752c19320e96488a0adaf4322995ed43f03f42757c71ab4ad371

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