Skip to content

Instantly share code, notes, and snippets.

@gallypette
Created March 14, 2022 09:07
Show Gist options
  • Save gallypette/8e4fc941443a2483b6b2fcaee4c76e47 to your computer and use it in GitHub Desktop.
Save gallypette/8e4fc941443a2483b6b2fcaee4c76e47 to your computer and use it in GitHub Desktop.
from pyail import PyAIL
import sys
import json
import uuid
ail_url = 'https://yourailIP:7000'
ail_key = ''
source_uuid = "{}".format(uuid.uuid4())
ailfeedertype = "ail_feeder_jabber"
try:
pyail = PyAIL(ail_url, ail_key, ssl=False)
except Exception as e:
print(e)
sys.exit(0)
for content in sys.stdin:
elm = json.loads(content)
tmp = elm['en']
tmpmt = {}
tmpmt['jabber:to'] = elm['to']
tmpmt['jabber:from'] = elm['from']
tmpmt['jabber:ts'] = elm['timestamp']
tmpmt['jabber:id'] = "{}".format(uuid.uuid4())
pyail.feed_json_item(tmp, tmpmt, ailfeedertype, source_uuid)
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment