# 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/ee/9f/63d3d118610ba1bae9e36fa87bac96749e1f41ade4adeee08005d54eff2e/perseus_restful_api_framework-1.28.8.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.8",
"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": "7fbad0a050bc63f027ca8c5d06606bb6bf57668bfbbadc0124e718ff44116e78",
"md5": "fcebae55a817bcc2459d14ddff717e6e",
"sha256": "e321efe1f85e492cda0a4c7751706882b7268bfcbabd37ac1a34205539829bb9"
},
"downloads": -1,
"filename": "perseus_restful_api_framework-1.28.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fcebae55a817bcc2459d14ddff717e6e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 5768705,
"upload_time": "2024-09-30T03:13:41",
"upload_time_iso_8601": "2024-09-30T03:13:41.421085Z",
"url": "https://files.pythonhosted.org/packages/7f/ba/d0a050bc63f027ca8c5d06606bb6bf57668bfbbadc0124e718ff44116e78/perseus_restful_api_framework-1.28.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ee9f63d3d118610ba1bae9e36fa87bac96749e1f41ade4adeee08005d54eff2e",
"md5": "5e2b8308633ca75372728b19b8ff8125",
"sha256": "52c9a9e64b8cb700a329c2f5d4de344213e3fde3b80ccffd853a869d75e35f98"
},
"downloads": -1,
"filename": "perseus_restful_api_framework-1.28.8.tar.gz",
"has_sig": false,
"md5_digest": "5e2b8308633ca75372728b19b8ff8125",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 5693776,
"upload_time": "2024-09-30T03:13:45",
"upload_time_iso_8601": "2024-09-30T03:13:45.204242Z",
"url": "https://files.pythonhosted.org/packages/ee/9f/63d3d118610ba1bae9e36fa87bac96749e1f41ade4adeee08005d54eff2e/perseus_restful_api_framework-1.28.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-30 03:13:45",
"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"
}