C++ HTTP/HTTPS server with Python API
Quick start
Server needs few files to run:
- web.json with routes
- Executors
- config.json with server settings
All these files must be in the same directory asmain.py
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.
Metadata
Release files for web-framework-api 3.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 289.1 MB
Release files / web_framework_api-3.4.2-cp314-cp314-win_amd64.whl
| Download URL | web_framework_api-3.4.2-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 6.4 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
d305e0fefd9444991dd98506ce64710aea098cdeb80c994f69817f9738ff6a80
|
|
BLAKE2b-256 checksum How to use checksums |
cb28afe26e8ae0884826589037687bdb5b07fa739982b68b4186ab79e8004ea0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp314-cp314-manylinux_2_34_x86_64.whl
| Download URL | web_framework_api-3.4.2-cp314-cp314-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 45.8 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
d3b7aa523eac2fe1e41380ea2ce6aa100bc3fdfcc13962ed2e60349e2cc5bb1a
|
|
BLAKE2b-256 checksum How to use checksums |
7896b6051032054bfa434474a300532b08feb0e2707ed26257640f54dc1d161e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp314-cp314-manylinux_2_34_aarch64.whl
| Download URL | web_framework_api-3.4.2-cp314-cp314-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 44.2 MB |
| Tags | CPython 3.14 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
0483ea9dc236b3bd398b384a54ccdf07fafc40c2c4236e3a5a10668800a90cad
|
|
BLAKE2b-256 checksum How to use checksums |
3b24f9ac014d993e684660d66d0bea95c5c43ece9d0fa61a06e00126a4316844
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp313-cp313-win_amd64.whl
| Download URL | web_framework_api-3.4.2-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 6.2 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1e5337fcbcef3b6e980391adfbc458c2a98c7053f898364b54c5a2ed09db8354
|
|
BLAKE2b-256 checksum How to use checksums |
caba4b6c4a6d8ea28541666030b5dd6915829e3f534e7b4f639b5c60ca7a53e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp313-cp313-manylinux_2_34_x86_64.whl
| Download URL | web_framework_api-3.4.2-cp313-cp313-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 45.8 MB |
| Tags | CPython 3.13 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
250fb45475b4391706573186bab82a2f5fdf2531f1c37d939c5585a3fc0f0a92
|
|
BLAKE2b-256 checksum How to use checksums |
b5938afe6c9284d25ece20403a57454f21bd2053fbbb338d50d87569885908c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp313-cp313-manylinux_2_34_aarch64.whl
| Download URL | web_framework_api-3.4.2-cp313-cp313-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 44.2 MB |
| Tags | CPython 3.13 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
9f4afefccefd55bc853dcc41cf7078699aa97c3df120f965aa7b55607a271bbb
|
|
BLAKE2b-256 checksum How to use checksums |
6dfd211608d7af9ff0d741ec3ba0f74a7cbb95efe09353754edce7a3d79a0773
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp312-cp312-win_amd64.whl
| Download URL | web_framework_api-3.4.2-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 6.2 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
0bee8e0062a90ffb25f79aa8e6e50524db0c80745b894995ad0daf355516ba41
|
|
BLAKE2b-256 checksum How to use checksums |
b3be4f7234fe811681bd2e3a480a3ce30b18eb2143b8a3dded7179b0d56f7d68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp312-cp312-manylinux_2_34_x86_64.whl
| Download URL | web_framework_api-3.4.2-cp312-cp312-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 45.8 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ x86-64 |
|
SHA-256 checksum How to use checksums |
7cd3a1faff32b846b1d00be1244e0157b9aad05375cf0d5df11e5ca8cb062ec4
|
|
BLAKE2b-256 checksum How to use checksums |
bf6908ebfea9b6e9d1b8ef23581afc667889102bcebecb0ef9c3a5acafcbc488
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / web_framework_api-3.4.2-cp312-cp312-manylinux_2_34_aarch64.whl
| Download URL | web_framework_api-3.4.2-cp312-cp312-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 44.2 MB |
| Tags | CPython 3.12 Linux glibc 2.34+ ARM64 |
|
SHA-256 checksum How to use checksums |
8b6a66da5073aa74ff878da169519bc089fd9656b7bb26daabbd77e65c17a2f9
|
|
BLAKE2b-256 checksum How to use checksums |
b4b7f3406939752c19320e96488a0adaf4322995ed43f03f42757c71ab4ad371
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|