Skip to main content

Decorators commonly used in building XA Cloud functions

Project description

XA Cloud Decorators

Decorators commonly used in building XA Cloud functions

secure_decorator: HTTP Header Authorization decorator.

Checks if X_AUTHORIZATION_KEY used is authorized. Returns Unauthorised HTTP Request invalid credentials if it fails

search_header_decorator: HTTP Header Search decorator.

Checks search parameter, X_API_SEARCH_KEY is valid. Returns Unsupported HTTP Request. Invalid header search key. if it fails

json_decorator: HTTP Content Type JSON decorator.

Checks if content-type is application/json. Returns Unsupported HTTP Request. Invalid header content type if it is not.

post_decorator: HTTP Request Method POST decorator.

Check if method is POST. Returns Unsupported HTTP Request. Invalid request method if it is not

elastic_search_query_decorator: Elasticsearch Query decorator.

Builds an ES query with query paramaters for search header == COORDINATES

    "bool": {
        "must": {
            "match_all": {}
        "filter": {
            "geo_shape": {
                "my_polygon": {
                    "shape": {
                        "type": "point",
                        "coordinates" : request_json['coordinates']
                    "relation": "contains"

Else query parameters

'query': {
    'match': {
        request_json['key']: request_json['value']

Returns Unsupported HTTP Request. if it fails

Project details

Download files

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

Files for xa-cloud-decorators, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size xa_cloud_decorators-1.0.1-py3-none-any.whl (3.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size xa_cloud_decorators-1.0.1.tar.gz (2.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page