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
"query":{
"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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
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 |
Hashes for xa_cloud_decorators-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee203e75b18e68e42ef01cfac3463d03915f4a5d5d27bb00c76b762fb6a1b44e |
|
MD5 | 131a2575484d4f619d941e198fe7d772 |
|
BLAKE2-256 | ec9cc96c8997281b1b0ca65b5778a8edce4ee1503b16631efc96104c48dbf3cf |
Hashes for xa_cloud_decorators-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfc065f925cd5f55db72d72dfaa56a7f5e233d91ddd05443d0c53a2d8e503c02 |
|
MD5 | 0b5ec2e3930043748d49f2c005d083a5 |
|
BLAKE2-256 | 4bb34b79e21b7600ee0d82aeb051d20404fbec2a055bbd43d3f2e326eb99a80a |