Asynchronous external HttpAPI invoker for Python , based on Fluent
Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc/images
AUTHORS
LICENSE
README.md
VERSION
asyncapi.py
server.py

README.md

fluent-python-asyncinvoker

Asynchronous external HttpAPI invoker for Python , based on Fluent

How to use

from asyncapi import AsyncHttpApi
AsyncHttpApi(
     api      = "http://localhost/api", # invoke api
     data     = {"name":name},  # send data
     callback = "http://localhost/callback", " callback api
).invoke()

Sequence

step1. res = {api}?data={data}
step2. {callback}?result={res}

http://localhost/callback?result=(http://localhost/api?data={"name":"name"})

Diagram

Diagram

Use-cases

  • build/rebuild indexes
  • push newsfeeds
  • sending email
  • etc...

More example

from asyncapi import AsyncHttpApi
class PushNotice(AsyncHttpApi):
    def __init__(self,**data):
        self.api      = "http://localhost/push/notice"
        self.callback = "http://localhost/push/callback"
        self.data     = data
        self.invoke()

PushNotice(type="alert",message="alert,alert")

Required

json

urllib2

Setting Fluent

install fluent-plugin-asyncinvoker

<source>
  type http
  port 8888
</source>

<match asyncinvoker.**>
  type asyncinvoker
  flush_interval 1s
</match>

Copyright

Copyright:: Copyright (c) 2011- Satoshi Miyauchi
License::   Apache License, Version 2.0