# Perseus: RESTful API Server Framework
Perseus is a Python framework for quickly building RESTful API servers with minimal effort.
Perseus provides an initial set of core services that supports the following features:
- Client application registration with API keys generation
- Client application access control with RESTful request signature
- Client application and RESTful API server version compatibility check
- User authentication and session management
- Team/group management
- RESTful request logging with data sensitiveness support
- RESTful service automatic discovery
- HTTP request query parameters & body JSON message automatically parsing (depending on the HTTP method used) with data type check and conversion
Perseus is based on [Tornado](https://www.tornadoweb.org/) for handling client network connection.
## RESTful API Request Handler
```python
from majormode.perseus.service.base_http_handler import HttpRequest
from majormode.perseus.service.base_http_handler import HttpRequestHandler
from majormode.perseus.service.base_http_handler import http_request
import AttendantService
class AttendantServiceHttpRequestHandler(HttpRequestHandler):
@http_request(r'^/attendant/session$',
http_method=HttpRequest.HttpMethod.POST,
authentication_required=False,
sensitive_data=True,
signature_required=False)
def sign_in(self, request):
email_address = request.get_argument(
'email_address',
data_type=HttpRequest.ArgumentDataType.email_address,
is_required=True)
password = request.get_argument(
'password',
data_type=HttpRequest.ArgumentDataType.string,
is_required=True)
return AttendantService().sign_in(request.app_id, email_address, password)
```
## Configure the environment variables
```env
# Copyright (C) 2021 Majormode. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Connection properties of the RESTful API server instances. Defaults
# to 127.0.0.1:8081.
API_SERVER_HOSTNAME=127.0.0.1
API_SERVER_PORTS=
# Root path of the Network File System (NFS) -- referring to the
# distributed file system (not the protocol) -- where the Content
# Delivery Network (CDN) files are stored into, such as avatars, etc.
CDN_NFS_ROOT_PATH=
# Hostname of the Content Delivery Network (CDN) server that hosts media
# files such as avatars, etc.
CDN_URL_HOSTNAME=
# Environment stage of the API server instances. Possible values are:
#
# - dev
# - int
# - staging
# - prod
#
# Defaults to `dev`.
ENVIRONMENT_STAGE=
# Connection properties to a Memcached server (a distributed memory
# object caching system). Defaults to 127.0.0.1:11211.
MEMCACHED_HOSTNAME = '127.0.0.1'
MEMCACHED_PORT = 11211
# Threshold for the logger to level. Logging messages which are less
# severe than the specified level will be ignored; logging messages
# which have this severity level or higher will be emitted. Possible
# values are:
#
# - debug
# - info
# - warning
# - error
# - critical
#
# Default to 'debug'.
LOGGING_LEVEL=
# Environment variables to select default parameter values to connect
# to PostgreSQL Relational Database Management System.
PG_HOSTNAME=localhost
PG_PORT=5432
PG_DATABASE_NAME=
PG_USERNAME=
PG_PASSWORD=
```
## Run the RESTful API Server Processes
```bash
$ fab start --port=65180,65181,...
```
Hashtags/Topics: `#perseus` `#restful` `#api` `#server` `#framework` `#python`
Raw data
{
"_id": null,
"home_page": "https://github.com/majormode/perseus-restful-api-server-framework",
"name": "perseus-restful-api-framework",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "perseus, resful, api, server, framework",
"author": "Daniel CAUNE",
"author_email": "daniel.caune@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e8/41/cb042478f4935e046f69a34b1bf9fc16e2b77fb0949ca8db80ad02b43183/perseus_restful_api_framework-1.28.15.tar.gz",
"platform": null,
"description": "# Perseus: RESTful API Server Framework\n\nPerseus is a Python framework for quickly building RESTful API servers with minimal effort.\n\nPerseus provides an initial set of core services that supports the following features:\n\n- Client application registration with API keys generation\n- Client application access control with RESTful request signature\n- Client application and RESTful API server version compatibility check\n- User authentication and session management\n- Team/group management\n- RESTful request logging with data sensitiveness support\n- RESTful service automatic discovery\n- HTTP request query parameters & body JSON message automatically parsing (depending on the HTTP method used) with data type check and conversion\n\nPerseus is based on [Tornado](https://www.tornadoweb.org/) for handling client network connection.\n\n## RESTful API Request Handler\n\n```python\nfrom majormode.perseus.service.base_http_handler import HttpRequest\nfrom majormode.perseus.service.base_http_handler import HttpRequestHandler\nfrom majormode.perseus.service.base_http_handler import http_request\n\nimport AttendantService\n\n\nclass AttendantServiceHttpRequestHandler(HttpRequestHandler):\n @http_request(r'^/attendant/session$',\n http_method=HttpRequest.HttpMethod.POST,\n authentication_required=False,\n sensitive_data=True,\n signature_required=False)\n def sign_in(self, request):\n email_address = request.get_argument(\n 'email_address',\n data_type=HttpRequest.ArgumentDataType.email_address,\n is_required=True)\n\n password = request.get_argument(\n 'password',\n data_type=HttpRequest.ArgumentDataType.string,\n is_required=True)\n\n return AttendantService().sign_in(request.app_id, email_address, password)\n```\n\n## Configure the environment variables\n\n```env\n# Copyright (C) 2021 Majormode. All rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n#\n# The above copyright notice and this permission notice shall be\n# included in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\n# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n# Connection properties of the RESTful API server instances. Defaults\n# to 127.0.0.1:8081.\nAPI_SERVER_HOSTNAME=127.0.0.1\nAPI_SERVER_PORTS=\n\n# Root path of the Network File System (NFS) -- referring to the\n# distributed file system (not the protocol) -- where the Content\n# Delivery Network (CDN) files are stored into, such as avatars, etc.\nCDN_NFS_ROOT_PATH=\n\n# Hostname of the Content Delivery Network (CDN) server that hosts media\n# files such as avatars, etc.\nCDN_URL_HOSTNAME=\n\n# Environment stage of the API server instances. Possible values are:\n#\n# - dev\n# - int\n# - staging\n# - prod\n#\n# Defaults to `dev`.\nENVIRONMENT_STAGE=\n\n# Connection properties to a Memcached server (a distributed memory\n# object caching system). Defaults to 127.0.0.1:11211.\nMEMCACHED_HOSTNAME = '127.0.0.1'\nMEMCACHED_PORT = 11211\n\n# Threshold for the logger to level. Logging messages which are less\n# severe than the specified level will be ignored; logging messages\n# which have this severity level or higher will be emitted. Possible\n# values are:\n#\n# - debug\n# - info\n# - warning\n# - error\n# - critical\n#\n# Default to 'debug'.\nLOGGING_LEVEL=\n\n# Environment variables to select default parameter values to connect\n# to PostgreSQL Relational Database Management System.\nPG_HOSTNAME=localhost\nPG_PORT=5432\nPG_DATABASE_NAME=\nPG_USERNAME=\nPG_PASSWORD=\n```\n\n## Run the RESTful API Server Processes\n\n```bash\n$ fab start --port=65180,65181,...\n```\n\nHashtags/Topics: `#perseus` `#restful` `#api` `#server` `#framework` `#python`\n",
"bugtrack_url": null,
"license": "Proprietary",
"summary": "Python server framework for quickly building RESTful APIs with minimal effort",
"version": "1.28.15",
"project_urls": {
"Homepage": "https://github.com/majormode/perseus-restful-api-server-framework",
"Repository": "https://github.com/majormode/perseus-restful-api-server-framework"
},
"split_keywords": [
"perseus",
" resful",
" api",
" server",
" framework"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e5ec3c4ba448005dbe6586af132f91663cda008aefbee91fbfb574d1c901cbbe",
"md5": "f92192111f4e698a5b0c3d33c383faba",
"sha256": "edc65edb81bacf78719c3cf27f3e643daaffa254b94478d51706f1181247f768"
},
"downloads": -1,
"filename": "perseus_restful_api_framework-1.28.15-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f92192111f4e698a5b0c3d33c383faba",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5768768,
"upload_time": "2025-01-17T01:16:50",
"upload_time_iso_8601": "2025-01-17T01:16:50.900292Z",
"url": "https://files.pythonhosted.org/packages/e5/ec/3c4ba448005dbe6586af132f91663cda008aefbee91fbfb574d1c901cbbe/perseus_restful_api_framework-1.28.15-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e841cb042478f4935e046f69a34b1bf9fc16e2b77fb0949ca8db80ad02b43183",
"md5": "70f9be56dfdf80b397fc937f1a329ea3",
"sha256": "a59f54f1b3612cae7067966f5e9399cc1574453ac0fbbb9b2cd73cd3596cf7e3"
},
"downloads": -1,
"filename": "perseus_restful_api_framework-1.28.15.tar.gz",
"has_sig": false,
"md5_digest": "70f9be56dfdf80b397fc937f1a329ea3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5692900,
"upload_time": "2025-01-17T01:16:54",
"upload_time_iso_8601": "2025-01-17T01:16:54.046972Z",
"url": "https://files.pythonhosted.org/packages/e8/41/cb042478f4935e046f69a34b1bf9fc16e2b77fb0949ca8db80ad02b43183/perseus_restful_api_framework-1.28.15.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-17 01:16:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "majormode",
"github_project": "perseus-restful-api-server-framework",
"github_not_found": true,
"lcname": "perseus-restful-api-framework"
}