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

Uploaded CPython 3.14Windows x86-64

web_framework_api-3.4.0-cp314-cp314-manylinux_2_34_x86_64.whl (14.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

web_framework_api-3.4.0-cp314-cp314-manylinux_2_34_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.13Windows x86-64

web_framework_api-3.4.0-cp313-cp313-manylinux_2_34_x86_64.whl (14.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

web_framework_api-3.4.0-cp313-cp313-manylinux_2_34_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.12Windows x86-64

web_framework_api-3.4.0-cp312-cp312-manylinux_2_34_x86_64.whl (14.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

web_framework_api-3.4.0-cp312-cp312-manylinux_2_34_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 26ad01b215734a3a05c9b5ce234f0808b9e309155f13abe6b649b3bd97909d90
MD5 cd4ecc6f58842756cead2ce0840a3816
BLAKE2b-256 8d711598445f1d59940666d907741a6a1a3dcfb1f6cd824ac14737f5a3705f54

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b13c0325fc9c4fb02d6ca31383a3c9b73845f59976f3b09fbc58ea5a4a07a3b9
MD5 6d1373062bb5f4fcddfc02048b399bae
BLAKE2b-256 ec337845e9fc1aa1ddaee08383b63be52314f50384905d0f47fd741a5c644bba

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3fc6b4d5456da3c89cca5ae2d5c8f7378a00a23de07defcac2ceec0edf820188
MD5 75a04398bd9dc4530750b0c4ab8acb5f
BLAKE2b-256 398ee0e53283478348ea9fad75c92ec235a1816fa4c03a8fcb85e7544b2bd3fe

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ea4095be99558b19acc2eb7739878498549e354e7b0bb4c79431a320831b4de9
MD5 58e4ea3197f709517c58c47a4dfbd380
BLAKE2b-256 aac88f312c1a8869916792647e00daa0577a02e68b6233ce53dc4429c8e1a613

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e0f4d40583ac8513d9af5051581263c1530700ee04f7ef4f52edc5e41a518b38
MD5 1d58b14fbbe155cb1ac3282ef4690434
BLAKE2b-256 b8efe2e46e2e026e0b2dc6eb4315275080cae3a4b724610de028b82d4da9ac0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 dbb9acaacda4c7de1ba315c96e5758bb2443dd1417ba81f264335d507479ea31
MD5 387389659f47fc0e14022979d4e376df
BLAKE2b-256 17c29555eb163ce1066cfead47d546eb48a5bb716d7068b61d0fdba384dba40e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 108777e0ac6727bdccd2c0641e4848ed1e12ba8a46c70d8f4c268a58a2137237
MD5 67f541adcc4385d099dbf79fcaedbdc3
BLAKE2b-256 43fccff154fa8c8bc6283e8f374246e632865f765228554abd80d6bdfa7bcacf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 10bb437848f1db014003c2831ef279d726097d412fc1b9fab27d889a59fa44f7
MD5 156baaf174333712f810cf3ae53a088c
BLAKE2b-256 f5a9012f77bb335049de64e190030a30bb41dbf9bea154b32b96c24c53a492f2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for web_framework_api-3.4.0-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 5437b3322dbc758027eb72b684be28b1f191ee2ea86f8ee75a7b62afaf653168
MD5 4d65aefcc7e6a60c18484d498a84bcbc
BLAKE2b-256 e0371d955b6d8225ad509df358832404ec7a236cd9d940b03f20463689ca4b18

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