Python server framework for quickly building RESTful APIs with minimal effort
Project description
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 for handling client network connection.
RESTful API Request Handler
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
# 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
$ fab start --port=65180,65181,...
Hashtags/Topics: #perseus
#restful
#api
#server
#framework
#python
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file perseus_restful_api_framework-1.28.8.tar.gz
.
File metadata
- Download URL: perseus_restful_api_framework-1.28.8.tar.gz
- Upload date:
- Size: 5.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.6 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52c9a9e64b8cb700a329c2f5d4de344213e3fde3b80ccffd853a869d75e35f98 |
|
MD5 | 5e2b8308633ca75372728b19b8ff8125 |
|
BLAKE2b-256 | ee9f63d3d118610ba1bae9e36fa87bac96749e1f41ade4adeee08005d54eff2e |
File details
Details for the file perseus_restful_api_framework-1.28.8-py3-none-any.whl
.
File metadata
- Download URL: perseus_restful_api_framework-1.28.8-py3-none-any.whl
- Upload date:
- Size: 5.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.6 Darwin/24.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e321efe1f85e492cda0a4c7751706882b7268bfcbabd37ac1a34205539829bb9 |
|
MD5 | fcebae55a817bcc2459d14ddff717e6e |
|
BLAKE2b-256 | 7fbad0a050bc63f027ca8c5d06606bb6bf57668bfbbadc0124e718ff44116e78 |