Django plugin for Zato
Project description
django-zato-plugin
A client library for invoking Zato services from Django applications.
Zato is an integration platform that orchestrates and automates your to APIs, databases, queues, and other systems.
Learn more here: https://zato.io
With this plugin, Django delegates integration work to Zato - your views call Zato services, Zato handles the rest. Less code in Django, all integrations in one place.
Installation
pip install django-zato-plugin
Configuration
Add to your Django settings:
ZATO_URL = 'http://localhost:17010/django'
ZATO_USERNAME = 'django'
ZATO_PASSWORD = 'password' # Use your Zato password, e.g. from the Zato_Password env. variable
API
The client exposes one method:
response = client.invoke(service, data=None)
- service - name of the Zato service to invoke (string)
- data - request data to send (dict or None)
Returns the response from the Zato service as a dict.
Usage
# views.py
from django.http import JsonResponse
from django_zato import client
def block_ip(request):
# Extract the request ..
ip_address = request.POST['ip_address']
reason = request.POST['reason']
# .. block on firewall and get the response ..
firewall_response = client.invoke('firewall.block-ip', {'ip_address': ip_address})
rule_id = firewall_response['rule_id']
# .. log incident in SIEM ..
siem_response = client.invoke('siem.log-incident', {
'ip_address': ip_address,
'reason': reason,
'action': 'blocked',
'firewall_rule_id': rule_id,
})
# .. Extract the response from SIEM ..
incident_id = siem_response['incident_id']
# .. and return the response to the frontend.
return JsonResponse({
'status': 'ok',
'firewall_rule_id': rule_id,
'siem_incident_id': incident_id,
})
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_zato_plugin-4.1.3.tar.gz.
File metadata
- Download URL: django_zato_plugin-4.1.3.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aea7e006c16ea8f8ed71096c1f6cfb9b2bcd02bbca7a7e50651fc835a086fd5
|
|
| MD5 |
fb6447472d79a92f94db7cc2d88a86c7
|
|
| BLAKE2b-256 |
6d17309aabb4e17274908f751de1d9c0501b1f6c2035a0d6c885e25ed1b8e357
|
File details
Details for the file django_zato_plugin-4.1.3-py3-none-any.whl.
File metadata
- Download URL: django_zato_plugin-4.1.3-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1f953688916f43ce139c2d3d049af37ab4b143443dd0d2c0ba549d0e022edaf
|
|
| MD5 |
8743c7090d75c648df16c91ef0e28b1e
|
|
| BLAKE2b-256 |
d1a883672bb0bb334a52e78bc734b3e94963284443b906333acb6a5ba9f988b9
|