Metadata-Version: 2.4
Name: reliqua
Version: 0.0.12
Summary: Simple, efficient, intuitive API Framework
Author-email: Terrence Meiczinger <terrence72@gmail.com>
License: MIT
Project-URL: homepage, https://github.com/tmeiczin/reliqua
Project-URL: documentation, https://github.com/tmeiczin/reliqua
Project-URL: repository, https://github.com/tmeiczin/reliqua
Keywords: utilities
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Unix
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: falcon>=3.0.0
Requires-Dist: falcon-cors
Requires-Dist: gunicorn>=19.6.0
Requires-Dist: pyyaml
Provides-Extra: dev
Requires-Dist: tox; extra == "dev"
Requires-Dist: requests; extra == "dev"
Requires-Dist: bump2version; extra == "dev"
Dynamic: license-file

This is sample template to create a quick Python Falcon API application. It uses a schema defined in the resource for the route path and OpenAPI documentation. The base application will handle creating the routes and documentation automatically at runtime.

You define a resource and the documentation will be auto-generated at startup using the docstrings.

```python

from reliqua.resources.base import Resource
from reliqua import status_codes as status


class User(Resource):

    __routes__ = [
        '/users/{id}',
    ]

    phone = phone

    def on_get(self, req, resp, id=None):
        """
        Retrieve a user. This value
        is awesome

        :param str id:       [in=path, required] User ID
        :param str email:    [in=query] User Email
        :param str phone:    [in=query enum] Phone Numbers

        :response 200:
        :response 400:

        :return json:
        """
        try:
            resp.media = users[int(id)]
        except IndexError:
            resp.status = status.HTTP_404

    def on_delete(self, req, resp, id=None):
        try:
            users.pop(int(id))
            resp.media = {'success': True}
        except IndexError
            resp.status = status.HTTP_400
```

This will create the /users/{id} endpoint and corresponding API documentation. The OpenAPI documentation and swagger.json will be dynamically generate at application startup. The OpenAPI ui will be available at:

```
http://<api-url>/docs/
```

and the swagger.json file located at:

```
http://<api-url>/docs/swagger.json
```

To create an application, you import the application template.

```python
from reliqua.app import Application

    
app = Application(
    bind='0.0.0.0:8000',
    ui_url = 'http://example.com/api',
    workers=1,
    resource_path='/var/www/html/resources'
)
app.run()
```

```
Where:

bind:           Address and port to listen for requests. [host:port]
ui_url:         The URL to the API when being used with a proxy, like nginx. If not supplied,
                then the bind address is used.
workers:        Number of worker threads to start.
resource_path:  This is where your python resource files are located.
```

Refer to the example application for more examples. You can install the library and example application

```
python setup.py install
```

You can execute the example application

```
$ reliqua-example 
```

From here the openapi-ui will be available at

````
http://localhost:8000/docs/
````
