Skip to main content

Aeros web server, based on Quart/Flask

Project description

Aeros Documentation

Aeros is a package containing wrappers for widely used Web and API functions. The whole package is based on Quart/Flask.

Getting started

This basic code snippet should get you ready for more. Remember that routed methods (the ones that are called on an HTTP endpoint) must be defined with async def, not def!

from Aeros import WebServer
from Aeros.misc import jsonify

app = WebServer(__name__, host="0.0.0.0", port=80)


@app.route("/")
async def home():
    return jsonify({"response": "ok"})


if __name__ == '__main__':
    app.start("-w 2")  # worker threads (for more arguments see hypercorn documentation)

Using sync methods in async methods

If you need to execute a synchronous method in an HTTP request handler and need to wait for its response, you should use sync_to_async from asgiref.sync. This method can also be imported from Aeros.misc:

from Aeros.misc import sync_to_async
import time

@sync_to_async
def sync_method():
    time.sleep(2)
    return "ok"

@app.route("/")
async def home():
    status = sync_method()
    return jsonify({"response": status})

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Aeros-0.0.8.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

Aeros-0.0.8-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file Aeros-0.0.8.tar.gz.

File metadata

  • Download URL: Aeros-0.0.8.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for Aeros-0.0.8.tar.gz
Algorithm Hash digest
SHA256 a3e90e39a5369d62b05faa5138ed743dda21fd40262d4aaa57cc2780a1869fc2
MD5 faa09074699a94d55d38a056b3a10198
BLAKE2b-256 f5a885d423c42c260d196c448a069b3bb5518c6129b44287c82cc1618ee4d8b7

See more details on using hashes here.

File details

Details for the file Aeros-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: Aeros-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6

File hashes

Hashes for Aeros-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6b70b4c9c12ba25e7bcc63c56384baca4c4ca66e480752d4b50a87cb5fc91485
MD5 e423d25329c1cf72fb39ebe8191125ee
BLAKE2b-256 51e042e5d830a8a3ee5edeeb1f584cdcc96049ca0bd79e3285b3a70377d08f91

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page