chalice-nuclei-ai


Namechalice-nuclei-ai JSON
Version 1.29.2 PyPI version JSON
download
home_pagehttps://github.com/NucleiAI/chalice
SummaryMicroframework - Nuclei FORK
upload_time2023-10-31 00:12:09
maintainer
docs_urlNone
authorNuclei AI
requires_python
licenseApache License 2.0
keywords chalice
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            =========================
AWS Chalice - Nuclei Fork
=========================

This is a fork of aws/chalice which contains custom features/fixes:

* Added option to configure the Ephemeral Storage available to a function.
* Added option to configure Maximum Concurrency for an SQS trigger.
* Fixed middleware for non-route blueprint functions

There are a few caveats with blueprint middleware:

* Registering a middleware function on a Blueprint just registers it on the
  app. There is no support for registering a middleware function on JUST the
  blueprint.

* For the middleware to work, you must import the chalice app file AFTER
  instantiating the blueprint, this must be done AFTER the instantiation to
  prevent import cycles. See the below example.

.. code-block:: python

    #### FILE app.py ####
    from chalice import Chalice
    from chalicelib.a_blueprint import a_bp

    def noop_middleware(event, get_response):
        print("Hello world from Middleware")
        return get_response(event)

    app = Chalice(__name__)

    # The ordering of these registrations is NOT important
    app.register_blueprint(a_bp)
    app.register_middleware(noop_middleware, 'all')

.. code-block:: python

    #### FILE chalicelib/a_blueprint.py ####
    from chalice import Blueprint

    a_bp = Blueprint(__name__)

    import app # AFTER the instantiation of `a_bp`

    @a_bp.schedule("rate(1 hour)")
    def hourly(event):
        print("Hello World from a Blueprint")


.. image:: https://badges.gitter.im/awslabs/chalice.svg
   :target: https://gitter.im/awslabs/chalice?utm_source=badge&utm_medium=badge
   :alt: Gitter
.. image:: https://readthedocs.org/projects/chalice/badge/?version=latest
   :target: http://aws.github.io/chalice/?badge=latest
   :alt: Documentation Status


.. image:: https://aws.github.io/chalice/_images/chalice-logo-whitespace.png
   :target: https://aws.github.io/chalice/
   :alt: Chalice Logo



Chalice is a framework for writing serverless apps in python. It allows
you to quickly create and deploy applications that use AWS Lambda.  It provides:

* A command line tool for creating, deploying, and managing your app
* A decorator based API for integrating with Amazon API Gateway, Amazon S3,
  Amazon SNS, Amazon SQS, and other AWS services.
* Automatic IAM policy generation


You can create Rest APIs:

.. code-block:: python

    from chalice import Chalice

    app = Chalice(app_name="helloworld")

    @app.route("/")
    def index():
        return {"hello": "world"}

Tasks that run on a periodic basis:

.. code-block:: python

    from chalice import Chalice, Rate

    app = Chalice(app_name="helloworld")

    # Automatically runs every 5 minutes
    @app.schedule(Rate(5, unit=Rate.MINUTES))
    def periodic_task(event):
        return {"hello": "world"}


You can connect a lambda function to an S3 event:

.. code-block:: python

    from chalice import Chalice

    app = Chalice(app_name="helloworld")

    # Whenever an object is uploaded to 'mybucket'
    # this lambda function will be invoked.

    @app.on_s3_event(bucket='mybucket')
    def handler(event):
        print("Object uploaded for bucket: %s, key: %s"
              % (event.bucket, event.key))

As well as an SQS queue:

.. code-block:: python

    from chalice import Chalice

    app = Chalice(app_name="helloworld")

    # Invoke this lambda function whenever a message
    # is sent to the ``my-queue-name`` SQS queue.

    @app.on_sqs_message(queue='my-queue-name')
    def handler(event):
        for record in event:
            print("Message body: %s" % record.body)


And several other AWS resources.

Once you've written your code, you just run ``chalice deploy``
and Chalice takes care of deploying your app.

::

    $ chalice deploy
    ...
    https://endpoint/dev

    $ curl https://endpoint/api
    {"hello": "world"}

Up and running in less than 30 seconds.
Give this project a try and share your feedback with us here on Github.

The documentation is available
`here <http://aws.github.io/chalice/>`__.

Quickstart
==========

.. quick-start-begin

In this tutorial, you'll use the ``chalice`` command line utility
to create and deploy a basic REST API.  This quickstart uses Python 3.7,
but AWS Chalice supports all versions of python supported by AWS Lambda,
which includes python3.6, python3.7, python3.8, python3.9, python3.10.
You can find the latest versions of python on the
`Python download page <https://www.python.org/downloads/>`_.

To install Chalice, we'll first create and activate a virtual environment
in python3.7::

    $ python3 --version
    Python 3.7.3
    $ python3 -m venv venv37
    $ . venv37/bin/activate

Next we'll install Chalice using ``pip``::

    $ python3 -m pip install chalice-nuclei-ai

You can verify you have chalice installed by running::

    $ chalice --help
    Usage: chalice [OPTIONS] COMMAND [ARGS]...
    ...


Credentials
-----------

Before you can deploy an application, be sure you have
credentials configured.  If you have previously configured your
machine to run boto3 (the AWS SDK for Python) or the AWS CLI then
you can skip this section.

If this is your first time configuring credentials for AWS you
can follow these steps to quickly get started::

    $ mkdir ~/.aws
    $ cat >> ~/.aws/config
    [default]
    aws_access_key_id=YOUR_ACCESS_KEY_HERE
    aws_secret_access_key=YOUR_SECRET_ACCESS_KEY
    region=YOUR_REGION (such as us-west-2, us-west-1, etc)

If you want more information on all the supported methods for
configuring credentials, see the
`boto3 docs
<http://boto3.readthedocs.io/en/latest/guide/configuration.html>`__.


Creating Your Project
---------------------

The next thing we'll do is use the ``chalice`` command to create a new
project::

    $ chalice new-project helloworld

This will create a ``helloworld`` directory.  Cd into this
directory.  You'll see several files have been created for you::

    $ cd helloworld
    $ ls -la
    drwxr-xr-x   .chalice
    -rw-r--r--   app.py
    -rw-r--r--   requirements.txt

You can ignore the ``.chalice`` directory for now, the two main files
we'll focus on is ``app.py`` and ``requirements.txt``.

Let's take a look at the ``app.py`` file:

.. code-block:: python

    from chalice import Chalice

    app = Chalice(app_name='helloworld')


    @app.route('/')
    def index():
        return {'hello': 'world'}


The ``new-project`` command created a sample app that defines a
single view, ``/``, that when called will return the JSON body
``{"hello": "world"}``.


Deploying
---------

Let's deploy this app.  Make sure you're in the ``helloworld``
directory and run ``chalice deploy``::

    $ chalice deploy
    Creating deployment package.
    Creating IAM role: helloworld-dev
    Creating lambda function: helloworld-dev
    Creating Rest API
    Resources deployed:
      - Lambda ARN: arn:aws:lambda:us-west-2:12345:function:helloworld-dev
      - Rest API URL: https://abcd.execute-api.us-west-2.amazonaws.com/api/

You now have an API up and running using API Gateway and Lambda::

    $ curl https://qxea58oupc.execute-api.us-west-2.amazonaws.com/api/
    {"hello": "world"}

Try making a change to the returned dictionary from the ``index()``
function.  You can then redeploy your changes by running ``chalice deploy``.

.. quick-start-end

Next Steps
----------

You've now created your first app using ``chalice``.  You can make
modifications to your ``app.py`` file and rerun ``chalice deploy`` to
redeploy your changes.

At this point, there are several next steps you can take.

* `Tutorials <https://aws.github.io/chalice/tutorials/index.html>`__
  - Choose from among several guided tutorials that will
  give you step-by-step examples of various features of Chalice.
* `Topics <https://aws.github.io/chalice/topics/index.html>`__ - Deep
  dive into documentation on specific areas of Chalice.
  This contains more detailed documentation than the tutorials.
* `API Reference <https://aws.github.io/chalice/api.html>`__ - Low level
  reference documentation on all the classes and methods that are part of the
  public API of Chalice.

If you're done experimenting with Chalice and you'd like to cleanup, you can
use the ``chalice delete`` command, and Chalice will delete all the resources
it created when running the ``chalice deploy`` command.

::

    $ chalice delete
    Deleting Rest API: abcd4kwyl4
    Deleting function aws:arn:lambda:region:123456789:helloworld-dev
    Deleting IAM Role helloworld-dev


Feedback
========

We'd also love to hear from you.  Please create any Github issues for
additional features you'd like to see over at
https://github.com/aws/chalice/issues.  You can also chat with us
on gitter: https://gitter.im/awslabs/chalice

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/NucleiAI/chalice",
    "name": "chalice-nuclei-ai",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "chalice",
    "author": "Nuclei AI",
    "author_email": "dev@nuclei.ai",
    "download_url": "https://files.pythonhosted.org/packages/9b/c2/5d2b341e2b7cdaf79a3277f9680089858eef834c0ea41b90173aaf60ea64/chalice-nuclei-ai-1.29.2.tar.gz",
    "platform": null,
    "description": "=========================\nAWS Chalice - Nuclei Fork\n=========================\n\nThis is a fork of aws/chalice which contains custom features/fixes:\n\n* Added option to configure the Ephemeral Storage available to a function.\n* Added option to configure Maximum Concurrency for an SQS trigger.\n* Fixed middleware for non-route blueprint functions\n\nThere are a few caveats with blueprint middleware:\n\n* Registering a middleware function on a Blueprint just registers it on the\n  app. There is no support for registering a middleware function on JUST the\n  blueprint.\n\n* For the middleware to work, you must import the chalice app file AFTER\n  instantiating the blueprint, this must be done AFTER the instantiation to\n  prevent import cycles. See the below example.\n\n.. code-block:: python\n\n    #### FILE app.py ####\n    from chalice import Chalice\n    from chalicelib.a_blueprint import a_bp\n\n    def noop_middleware(event, get_response):\n        print(\"Hello world from Middleware\")\n        return get_response(event)\n\n    app = Chalice(__name__)\n\n    # The ordering of these registrations is NOT important\n    app.register_blueprint(a_bp)\n    app.register_middleware(noop_middleware, 'all')\n\n.. code-block:: python\n\n    #### FILE chalicelib/a_blueprint.py ####\n    from chalice import Blueprint\n\n    a_bp = Blueprint(__name__)\n\n    import app # AFTER the instantiation of `a_bp`\n\n    @a_bp.schedule(\"rate(1 hour)\")\n    def hourly(event):\n        print(\"Hello World from a Blueprint\")\n\n\n.. image:: https://badges.gitter.im/awslabs/chalice.svg\n   :target: https://gitter.im/awslabs/chalice?utm_source=badge&utm_medium=badge\n   :alt: Gitter\n.. image:: https://readthedocs.org/projects/chalice/badge/?version=latest\n   :target: http://aws.github.io/chalice/?badge=latest\n   :alt: Documentation Status\n\n\n.. image:: https://aws.github.io/chalice/_images/chalice-logo-whitespace.png\n   :target: https://aws.github.io/chalice/\n   :alt: Chalice Logo\n\n\n\nChalice is a framework for writing serverless apps in python. It allows\nyou to quickly create and deploy applications that use AWS Lambda.  It provides:\n\n* A command line tool for creating, deploying, and managing your app\n* A decorator based API for integrating with Amazon API Gateway, Amazon S3,\n  Amazon SNS, Amazon SQS, and other AWS services.\n* Automatic IAM policy generation\n\n\nYou can create Rest APIs:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name=\"helloworld\")\n\n    @app.route(\"/\")\n    def index():\n        return {\"hello\": \"world\"}\n\nTasks that run on a periodic basis:\n\n.. code-block:: python\n\n    from chalice import Chalice, Rate\n\n    app = Chalice(app_name=\"helloworld\")\n\n    # Automatically runs every 5 minutes\n    @app.schedule(Rate(5, unit=Rate.MINUTES))\n    def periodic_task(event):\n        return {\"hello\": \"world\"}\n\n\nYou can connect a lambda function to an S3 event:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name=\"helloworld\")\n\n    # Whenever an object is uploaded to 'mybucket'\n    # this lambda function will be invoked.\n\n    @app.on_s3_event(bucket='mybucket')\n    def handler(event):\n        print(\"Object uploaded for bucket: %s, key: %s\"\n              % (event.bucket, event.key))\n\nAs well as an SQS queue:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name=\"helloworld\")\n\n    # Invoke this lambda function whenever a message\n    # is sent to the ``my-queue-name`` SQS queue.\n\n    @app.on_sqs_message(queue='my-queue-name')\n    def handler(event):\n        for record in event:\n            print(\"Message body: %s\" % record.body)\n\n\nAnd several other AWS resources.\n\nOnce you've written your code, you just run ``chalice deploy``\nand Chalice takes care of deploying your app.\n\n::\n\n    $ chalice deploy\n    ...\n    https://endpoint/dev\n\n    $ curl https://endpoint/api\n    {\"hello\": \"world\"}\n\nUp and running in less than 30 seconds.\nGive this project a try and share your feedback with us here on Github.\n\nThe documentation is available\n`here <http://aws.github.io/chalice/>`__.\n\nQuickstart\n==========\n\n.. quick-start-begin\n\nIn this tutorial, you'll use the ``chalice`` command line utility\nto create and deploy a basic REST API.  This quickstart uses Python 3.7,\nbut AWS Chalice supports all versions of python supported by AWS Lambda,\nwhich includes python3.6, python3.7, python3.8, python3.9, python3.10.\nYou can find the latest versions of python on the\n`Python download page <https://www.python.org/downloads/>`_.\n\nTo install Chalice, we'll first create and activate a virtual environment\nin python3.7::\n\n    $ python3 --version\n    Python 3.7.3\n    $ python3 -m venv venv37\n    $ . venv37/bin/activate\n\nNext we'll install Chalice using ``pip``::\n\n    $ python3 -m pip install chalice-nuclei-ai\n\nYou can verify you have chalice installed by running::\n\n    $ chalice --help\n    Usage: chalice [OPTIONS] COMMAND [ARGS]...\n    ...\n\n\nCredentials\n-----------\n\nBefore you can deploy an application, be sure you have\ncredentials configured.  If you have previously configured your\nmachine to run boto3 (the AWS SDK for Python) or the AWS CLI then\nyou can skip this section.\n\nIf this is your first time configuring credentials for AWS you\ncan follow these steps to quickly get started::\n\n    $ mkdir ~/.aws\n    $ cat >> ~/.aws/config\n    [default]\n    aws_access_key_id=YOUR_ACCESS_KEY_HERE\n    aws_secret_access_key=YOUR_SECRET_ACCESS_KEY\n    region=YOUR_REGION (such as us-west-2, us-west-1, etc)\n\nIf you want more information on all the supported methods for\nconfiguring credentials, see the\n`boto3 docs\n<http://boto3.readthedocs.io/en/latest/guide/configuration.html>`__.\n\n\nCreating Your Project\n---------------------\n\nThe next thing we'll do is use the ``chalice`` command to create a new\nproject::\n\n    $ chalice new-project helloworld\n\nThis will create a ``helloworld`` directory.  Cd into this\ndirectory.  You'll see several files have been created for you::\n\n    $ cd helloworld\n    $ ls -la\n    drwxr-xr-x   .chalice\n    -rw-r--r--   app.py\n    -rw-r--r--   requirements.txt\n\nYou can ignore the ``.chalice`` directory for now, the two main files\nwe'll focus on is ``app.py`` and ``requirements.txt``.\n\nLet's take a look at the ``app.py`` file:\n\n.. code-block:: python\n\n    from chalice import Chalice\n\n    app = Chalice(app_name='helloworld')\n\n\n    @app.route('/')\n    def index():\n        return {'hello': 'world'}\n\n\nThe ``new-project`` command created a sample app that defines a\nsingle view, ``/``, that when called will return the JSON body\n``{\"hello\": \"world\"}``.\n\n\nDeploying\n---------\n\nLet's deploy this app.  Make sure you're in the ``helloworld``\ndirectory and run ``chalice deploy``::\n\n    $ chalice deploy\n    Creating deployment package.\n    Creating IAM role: helloworld-dev\n    Creating lambda function: helloworld-dev\n    Creating Rest API\n    Resources deployed:\n      - Lambda ARN: arn:aws:lambda:us-west-2:12345:function:helloworld-dev\n      - Rest API URL: https://abcd.execute-api.us-west-2.amazonaws.com/api/\n\nYou now have an API up and running using API Gateway and Lambda::\n\n    $ curl https://qxea58oupc.execute-api.us-west-2.amazonaws.com/api/\n    {\"hello\": \"world\"}\n\nTry making a change to the returned dictionary from the ``index()``\nfunction.  You can then redeploy your changes by running ``chalice deploy``.\n\n.. quick-start-end\n\nNext Steps\n----------\n\nYou've now created your first app using ``chalice``.  You can make\nmodifications to your ``app.py`` file and rerun ``chalice deploy`` to\nredeploy your changes.\n\nAt this point, there are several next steps you can take.\n\n* `Tutorials <https://aws.github.io/chalice/tutorials/index.html>`__\n  - Choose from among several guided tutorials that will\n  give you step-by-step examples of various features of Chalice.\n* `Topics <https://aws.github.io/chalice/topics/index.html>`__ - Deep\n  dive into documentation on specific areas of Chalice.\n  This contains more detailed documentation than the tutorials.\n* `API Reference <https://aws.github.io/chalice/api.html>`__ - Low level\n  reference documentation on all the classes and methods that are part of the\n  public API of Chalice.\n\nIf you're done experimenting with Chalice and you'd like to cleanup, you can\nuse the ``chalice delete`` command, and Chalice will delete all the resources\nit created when running the ``chalice deploy`` command.\n\n::\n\n    $ chalice delete\n    Deleting Rest API: abcd4kwyl4\n    Deleting function aws:arn:lambda:region:123456789:helloworld-dev\n    Deleting IAM Role helloworld-dev\n\n\nFeedback\n========\n\nWe'd also love to hear from you.  Please create any Github issues for\nadditional features you'd like to see over at\nhttps://github.com/aws/chalice/issues.  You can also chat with us\non gitter: https://gitter.im/awslabs/chalice\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Microframework - Nuclei FORK",
    "version": "1.29.2",
    "project_urls": {
        "Homepage": "https://github.com/NucleiAI/chalice"
    },
    "split_keywords": [
        "chalice"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f41a1a0581d72a84986b7edaff9b7e176d63a22e9a0a25071aaac1fc838d237f",
                "md5": "1623783c87da3bc5baefad2e50fccbd4",
                "sha256": "fd65d451c63dd47e538c9d3c1bbb6c423772d55b2db97b8c28f07fa90db1a0da"
            },
            "downloads": -1,
            "filename": "chalice_nuclei_ai-1.29.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1623783c87da3bc5baefad2e50fccbd4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 265850,
            "upload_time": "2023-10-31T00:12:06",
            "upload_time_iso_8601": "2023-10-31T00:12:06.518188Z",
            "url": "https://files.pythonhosted.org/packages/f4/1a/1a0581d72a84986b7edaff9b7e176d63a22e9a0a25071aaac1fc838d237f/chalice_nuclei_ai-1.29.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9bc25d2b341e2b7cdaf79a3277f9680089858eef834c0ea41b90173aaf60ea64",
                "md5": "70e38d253160efbccb3925cc4da9a0f6",
                "sha256": "1b876d9478bf86d2cf51b6ca5ce7a6bf6fbf65b2c0b0ebc730ff96aaea58236b"
            },
            "downloads": -1,
            "filename": "chalice-nuclei-ai-1.29.2.tar.gz",
            "has_sig": false,
            "md5_digest": "70e38d253160efbccb3925cc4da9a0f6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 259686,
            "upload_time": "2023-10-31T00:12:09",
            "upload_time_iso_8601": "2023-10-31T00:12:09.243546Z",
            "url": "https://files.pythonhosted.org/packages/9b/c2/5d2b341e2b7cdaf79a3277f9680089858eef834c0ea41b90173aaf60ea64/chalice-nuclei-ai-1.29.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-31 00:12:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "NucleiAI",
    "github_project": "chalice",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "chalice-nuclei-ai"
}
        
Elapsed time: 1.28744s