Skip to content

Asynchronous server using aiohttp, threads and publish-subscribe mechanism. The project uses asynchronous loop like a rattlesnake. :)

Notifications You must be signed in to change notification settings

pagan-coder/RattlePy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RattlePy

RattlePy is a simple asynchronous web server, that allows asynchronous processing of incoming user requests, hence offers scalability in terms of memory and CPU time.

Long running synchronous tasks can be processed on threads and thus be connected to the asynchronous loop using the Executor object.

Notification among coroutines can be obtained via publish-subscribe mechanism in the Messenger object.

Usage

import rattlepy
import aiohttp

class MyServerApplication(rattlepy.RattlePyApplication):

	def prepare_routes(self):
		"""
		Register custom routes.
		:return:
		"""
		self.Routes.append(aiohttp.web.get("/v", self.version))

	async def version(self, request):
		"""
		A simple endpoint that returns JSON response.
		:param request: request
		:return: response
		"""
		return aiohttp.web.json_response({"v": 1})


if __name__ == '__main__':
	app = MyServerApplication()
	app.serve()

About

Asynchronous server using aiohttp, threads and publish-subscribe mechanism. The project uses asynchronous loop like a rattlesnake. :)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published