GUI Style Events for Web Applications
Project description
Ffire enables you to use GUI Style event driven programming in your web application with 10 lines of code or less.
ffire can be summed up by its simple API.
Installation
pip install ffire
Creating and Firing Events
#: Order Creation API/Engine : Application One (France or Germany or Mars)
from ffire import fire
#: Create is idempotent. You can call create multiple times without side effects
#: in addition it is more advisable to use constants i.e. ORDER_CREATED not literals
ffire.create('order_created', category='event')
#: Do application logic here
payload = {"order_id": "abcd", "client_id": "1234"}
ffire('order_created', payload)
#: OR
ffire.fire('order_created', payload)
Subscribing to events
# # Biryani Client : Application Two in (Brazil, South Africa or Venus)
from ffire import fire
endpoint = 'http://api.example.com/order-created-handler'
fire.subscribe('order_created', endpoint)
#: Ffire assumes a handler for the payload sits at that endpoint.
It is advisable to have a message broker as the endpoint. However this is not mandatory especially for cases where handling the event is not an absolute necessity.
In such scenarios any endpoint is sufficient.
Consume Events
If you wish to consume events from ffire explicitly you can do so.
from ffire import ffire
fire.consume('order_created', ffire.TIME_INTERVALS.ONE_HOUR)
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
ffire-0.1.0.tar.gz
(8.6 kB
view details)
File details
Details for the file ffire-0.1.0.tar.gz
.
File metadata
- Download URL: ffire-0.1.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36b17610bf93a8f193a1e588d664e8594ea05b4805701793600855d3f283789e |
|
MD5 | 76d33ec814192a034fb5fc5c6b1b2147 |
|
BLAKE2b-256 | 3b81e47a818463d5ef2181a2a1b973ddd33fde7c1d6132c6365897b8eaadc9f6 |